C Program to Add two numbers. In this program we will take two numbers as an input from the user and display the sum of these two number.
In the following program we will add two numbers input by the user.
//Swap two Numbers
#include<stdio.h>
void main()
{
//variable declaration
int x,y,z;
printf("enter two numbers for sum \n");
//input from user
scanf("%d%d",&x,&y);
//process
z=x+y;
//final output
printf("The sum is %d",z);
}
Figure 1
Figure 2