C++ program which accept two numbers and print their sum.

Simple C++ program to add two numbers

In this program we are asking user to input two integer numbers and then we are adding them and displaying the result on screen.

Source Code:

#include<iostream>
using namespace std;

int main()
{
 int a,b,c;
 cout<< "\nEnter first number : ";
 cin>>a;
 cout<<"\nEnter second number : ";
 cin>>b;
 c=a+b;
 cout<<"\nThe Sum is : "<<c;
 
 
 return 0;
}




C++ program to add two numbers can be done by Function Overloading or Using Class and Function.

More: 


Post a Comment

 
Top