C Program to find sum of two numbers



#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter first number:");
scanf("%d",&a);
printf("\nEnter second number:");
scanf("%d",&b);
c=a+b;
printf("\nAddition of two numbers is:%d",c);
getch();
}

Explanation:

On Execution of the above program, you will get the addition of two integer numbers. There are two integer type variables 'a' and 'b'. Variable 'a' will contain the value of first number and variable 'b' will contain the value of second number on which we have to perform the addition operation. These values will be entered by the user on run time with the help of scanf statement. The statement 'c=a+b' will perform addition operation over the values present in variables 'a' and 'b' and the result of this operation will be stored in the third integer type variable 'c'. The value of c variable will be print at run time with the help of 'printf' statement. You can understand this process with the help of this example:
a=5
b=4
c=a+b means c=9
so c=9
The output of the above program is given below:

Output:

c program