Home > Software engineering >  Why can't I add \n after a float in C to create another line?
Why can't I add \n after a float in C to create another line?

Time:10-17

printf("%f  %.3f  %.2f  %.1f", 4.5678, 4.5678, 4.5678, 4.5678);

I tried putting \n at the end of the series of floats to separate the line

printf("%f  %.3f  %.2f  %.1f", 4.5678, 4.5678, 4.5678, 4.5678)\n;

CodePudding user response:

That \n should be inside the strings of printf not after it

printf("%f  %.3f  %.2f  %.1f \n", 4.5678, 4.5678, 4.5678, 4.5678);
  •  Tags:  
  • c
  • Related