Program to Add Two Numbers in CPP

In this program, the user is asked to enter two numbers which are stored in a and b respectively. 
The + operator is used for adding these two numbers and the result is stored in variable sum. 
Finally, the sum is displayed and the program is terminated.

#include<iostream.h>
#include<conio.h>

int main() 
{ 
 int a, b, sum;
 clrscr();
  
 cout << "Enter first no:";
 cin >> a;
  
 cout << "Enter second no:";
 cin >> b;
  
    sum = a + b;

 cout << “Sum is = “ << sum;
	
  getch();
}

Output is 
Enter first no:25 
Enter second no:45 
Sum is = 70 

Leave a Reply