Search This Blog

Sunday, July 3, 2022

C Program | C Programming | printf() function to write multiple lines using new line \n.

C Program| C Programming| C Language | Basics of C| C new lines


How to use printf() function to write multiple lines using \n, however it makes the code difficult to read.


#include<stdio.h>

int main() {

  printf("Hello World! \n I am learning C.\n Its Great learning C!");
  return 0;
}

Output will be:

Hello World!
I am learning C.
Its Great learning C!

Second way to write C program using new line.

#include <stdio.h>

int main() {
  printf("Hello World!\n\n");
  printf("I am learning C.");
  return 0;
}

Output:

Hello World!


I am Learning C.

No comments:

Post a Comment