Assingment -1
Title
Question
// My First C Program
#include <stdio.h>
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
#include <stdio.h>
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
Mohan S
19ECE16
C-and-Cpp First-C-Program 04-05 min 10-20 sec
Answers:
Assignments are only for self-assessment. If you have any specific question related to this tutorial please post here.
#include<stdio.h>
int main()
{
printf("Welcome to the World of C");
getch();
}
getch(); is use in void main() function return 0; is use in int main() function
Login to add comment
#include<conio.h>
#include<stdio.h>void main()
{
clrscr();
printf("Welcome to the World of C");
getch();
}
<span style="color: #a626a4;">#include</span><span style="color: #50a14f;"><stdio.h></span>
<span style="color: #a626a4;">int</span> <span style="color: #4078f2;">main</span>()
{
<span style="color: #4078f2;">printf</span>(<span style="color: #50a14f;">"Welcome to the World of C"</span>);
<span style="color: #a0a1a7;font-style: italic;">//If the /n is included in the beginning of the statement then the statement gets printed on to the next line </span>
<span style="color: #a0a1a7;font-style: italic;">// If the /n is not included in the beginning of the statement then the statement gets printed on to the first line </span>
<span style="color: #a0a1a7;font-style: italic;">//but if the new statement is to be printed then it will printed on the 3rd line</span>
}
#include <stdio.h>
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
answer: welcome to the world of C
<font size="3">#include<stdio.h></font>
<font size="3">#include<conio.h></font>
<font size="3">int main()</font>
<font size="3">{</font>
<font size="3">printf("welcome to the world of c \n");</font>
<font size="3">return 0;</font>
<font size="3">}</font>
output:
welcome to the world of c
if \n is not placed in printf ,the statements in the next lines are print in the same line
<font size="3">#include<stdio.h></font>
<font size="3">#include<conio.h></font>
<font size="3">int main()</font>
<font size="3">{</font>
<font size="3">printf("welcome to the world of c \n");</font>
<font size="3">return 0;</font>
<font size="3">}</font>
output:
welcome to the world of c
if \n is not placed in printf ,the statements in the next lines are print in the same line
<span style="background-color: rgb(250, 250, 250);">#include <stdio.h></span>
<span style="background-color: rgb(250, 250, 250);">int main()</span>
<span style="background-color: rgb(250, 250, 250);">{</span>
<span style="background-color: rgb(250, 250, 250);"> printf("welcome to the world of C \n ");</span>
<span style="background-color: rgb(250, 250, 250);"> return 0;</span>
<span style="background-color: rgb(250, 250, 250);">}</span>
<span style="background-color: rgb(250, 250, 250);">int main()</span>
<span style="background-color: rgb(250, 250, 250);">{</span>
<span style="background-color: rgb(250, 250, 250);"> printf("welcome to the world of C \n ");</span>
<span style="background-color: rgb(250, 250, 250);"> return 0;</span>
<span style="background-color: rgb(250, 250, 250);">}</span>
Output:
welcome to the world of C
<span style="background-color: rgb(250, 250, 250);">
</span>
</span>
#include <stdio.h>
int main()
{
printf ("welcome to the world of c\n");
return0;
}
answer: welcome to the world of c
#include <stdio.h>
int main()
{
printf ("welcome to the world of c\n");
return0;
}
answer: welcome to the world of c
#include <stdio.h>
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
answer: welcome to the world of C
#include <stdio.h>
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
int main()
{
printf("welcome to the world of C \n ");
return 0;
}
answer: welcome to the world of C
#include<stdio.h>
int main()
{
printf("welcome to c world");
return 0;
}
#include<stdio.h>
int main()
{
printf("welcome to c world");
return 0;
}
#include<stdio.h>
int main()
{
printf("welcome to c world");
return 0;
}
out put:welcome to c world
#include<stdio.h>
int main()
{
printf("welcome to c world");
return 0;
}
output:welcome to c world
#include<stdio.h>
int main()
{
printf("welcome to c world");
return 0;
}
output:welcome to c world
Login to add comment