Write a program in C++ to print the sum of two numbers.

Print the sum of two numbers:

-----------------------------------

The sum of 29 and 30 is: 59


#include<iostream>

using namespace std;

int main()

{

int sum,a,b;

cout<<"enter your number 1: ";

cin>>a;

cout<<"enter your number 2: ";

cin>>b;

sum=a+b;

cout<<"--------------------"<<endl;

cout<<"The sum of "<< a<<" and "<< b<<" is: "<< sum;

}


Output:

Write a program in C++ to print the sum of two numbers.

Post a Comment

Please do not enter any spam link in the comment box.

Previous Post Next Post