C++ program which adds two integers

#include <iostream.h>
main() {
// A simple C++ program
int x, y, sum;
cout << “A program which adds two integers\n”;
cout << “Enter 1st integer: “;
cin >> x;
cout << “Enter 2nd integer: “;
cin >> y;
sum = x + y;
cout << “Sum is ” << sum << endl;
return 0;
}

 

Output :
A program which adds two integers
Enter 1st integer: 3
Enter 2nd integer: 4
Sum is 7

Leave a Comment