C Program to Add Two Numbers, C Program to Add Two Integers

C Program to Add Two Numbers, C Program to Add Two Integers

c addition program is a very basic program in c. addition program in c refers to an addition of numbers.in this program user will enter any two number of their choice and program returns sum of that two numbers as output.

C Addition Program



Void main()


int num1,num2;          

int sum;

printf(“Enter First Number:”);


printf(“Enter Second Number:”);


printf(“Addition Of Entered Two Numbers Is:%d”,sum);




Enter First Number:10

Enter Second Number:20

Addition Of Entered Two Numbers Is:30


In above program


In first two lines contains the header files. Header files are nothing but the  libraries of c programming. 

Inbuilt functions and features which are we using in program such as printf(),scanf(),getch() etc are defined in these header files.

If you doesn’t include these header files write program you got error messages. These
function cant work without including header files.

void main() :

this is the main function of c programming. Program execution starts from here. Void is the return type of main function. 

It may be change such int main(), void return type means it doesn’t return anything so void is defined as return type of main ().

int num1,num2: 

int this line we declare two variables of int type num1 and num2 respectively. These two variable accepts integer numbers in run time user enters.

int sum:

In this line we declare sum variable of int type to store the addition of above two variables num1 and num2. The variables num1 and num2 are type of int so that their addition also of int type so we declare sum variable as int type.


printf() will print the message on the screen which is mentioned int the double inverted quo ma in brackets.


scanf() function is used to store data in variables at  run time. It accepts value from user at run time. If users enter valid value same as data type it accept it and store in that particular variable.


In this line program performs addition of num1 and num2 variables and it assign it to the variable sum.


This function hold the screen. This function is defined in  #include<conio.h>

Post a Comment

Previous Post Next Post