Answer to Question #5801 in C++ for Jade Devin

Question #5801
The category must be c... but i tried putting it into c yet it doesn't work..... well here is the question... tnx in advance

Why do you need to put \n after an specifier in doing loop commands?

like this:

for(d=15;d<20;d++){
printf("%d\n", d);
}

i tried removing \n yet it doesn't work, why is it so?
1
Expert's answer
2011-12-27T09:55:45-0500
#include <stdlib.h>




int main() {

int d;

for (d = 15; d < 20; d++) {

printf("%d
", d);

}

return 0;

}




//we should use '
' to go to new line

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS