Simple program in c language

fist open application turbo c or code block today many more editor are available on which we can write and run program but turbo c and code block ease to use.

first we add the header file #include<stdio.h> and #include<conio.h>

#include<stdio.h> means stander input output header file that include class file related input and output code. (# means All) include means do include.

#include<conio.h> means console input output header that class file that support to output screen is also known as console output screen. (# means All) include means do include.

then we write the function void main() or int main() this is the main function where from we start the program. after void main() and int main() we use the curly brace open and close using symbol {open }close between open and close symbol we write the program code.

void main() means none return value function type that cannot return any value.

Example:

#include<stdio.h>

#include<conio.h>

void main()

{

printf(“hello all India education system”);

getch(); //this function stay output screen until you press any key

}

Output:

hello all India education system

int main() means return something at least 0. when we use int main() function then we should write the code return 0 before closing of program.

example

#include<stdio.h>

#include<conio.h>

int main()

{

printf(“hello all India education system”);

return 0;

getch(); //this function stay output screen until you press any key

}

Output:

hello all India education system

above we use // for comment line there is two type of comment section

  1. single line comment : in single line comment we use //
  2. multi-line comment: in multi-line comment section we use /* */ between two star we type the message for comment.

printf(); is a function use to print any type of message and value we will learnt about how to print value.

Categories: c language

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *