Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

What is the use of "\n"?

0 votes
asked Mar 21, 2019 by Sai Sumanth (120 points)

6 Answers

0 votes
answered Mar 21, 2019 by Admin (5,100 points)

To print newline. 

To see the difference made by "\n", check out below code.

#include <stdio.h>
int main()
{
    printf("Hello ");
    printf("World, in same line.");
    printf("\n I am in newline");
    return 0;
}
0 votes
answered Mar 29, 2019 by anonymous
to print in a new line
0 votes
answered Mar 30, 2019 by Aditya Singh Amar (140 points)
make a new line
0 votes
answered Mar 31, 2019 by programmer unemployed
"\n" is used to take the curser in next line
0 votes
answered Mar 31, 2019 by anonymous
Print line by line
0 votes
answered Mar 31, 2019 by S.Strange 013

\n helps us to move our cursor to next line

example: if we write System.out.print("We \n Are One....." );   (JAVA STATEMENT)

Our Output will be:

We

Are One

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...