Write a C program to print words using spacing and new line characters
Description: Print the words Learn, C and Programming in a new line each, and then in one line with tab spaces.
Hint:
- Use
\nfor a new line and\tfor a tab space.
C program to print words with escape sequences
#include <stdio.h>
int main(void) {
printf("Learn\nC\nProgramming\n");
printf("Learn\tC\tProgramming\n");
return 0;
}
Output:
Output of the above program is
Learn
C
Programming
Learn C Programming
How it works
- One
printf()can print many lines. We only write\nwhere the new line is needed. \tadds a horizontal tab between the words.
Read C Escape Sequences.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |