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?

Expert's answer

#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
LATEST TUTORIALS
APPROVED BY CLIENTS