0% found this document useful (0 votes)
24 views2 pages

Jiya Hiten Shah First C Program

The document presents a simple C program that prints 'Welcome to the World of C' and demonstrates the effect of including or omitting the newline character '\n' in the printf statement. It explains that using '\n' moves the cursor to the next line, while omitting it results in subsequent output being printed on the same line. Two versions of the program are provided to illustrate this difference.

Uploaded by

yugshah197
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Jiya Hiten Shah First C Program

The document presents a simple C program that prints 'Welcome to the World of C' and demonstrates the effect of including or omitting the newline character '\n' in the printf statement. It explains that using '\n' moves the cursor to the next line, while omitting it results in subsequent output being printed on the same line. Two versions of the program are provided to illustrate this difference.

Uploaded by

yugshah197
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

FIRST C PROGRAM

- Jiya Hiten Shah

Question:
Write a program to print "Welcome to the World of C".
See what happens if \n is not included in the printf statement.

Answer:
i. Write a program to print "Welcome to the World of C".

PROGRAM

//Assignment 1 - Write a program to print "Welcome to the World of C"


#include <stdio.h>
int main()
{
printf("Welcome to the World of C\n");
return 0;
}

ii. See what happens if \n is not included in the printf statement.

PROGRAM

//Assignment 1 - Write a program to print "Welcome to the World of C"


//See what happens if \n is not included in the printf statement.
#include <stdio.h>
int main()
{
printf("Welcome to the World of C");
return 0;
}

OUTPUT (For above two program)

i.
ii.

The \n character moves the cursor to the next line after printing while without \n, the next
output will be printed on the same line

You might also like