write a c++ program to display the sum of two integers taking input from the user
Answers
Answered by
4
#include <iostream>
using namespace std;
int main() {
int num1, num2;
cin >> num1;
cin >> num2;
cout << num1 + num2;
return 0;
}
- First it includes an header file named iostream.
- Then it declares that it is gonna use standard namespace.
- Note that C++ ignores white spaces.
- Then comes the main method.
- We declare two integers called "num1", "num2".
- Both integers take their respective inputs then.
- We print the sum and finish the program.
- "return 0" tells that the method is not gonna return anything.
Hope it helps..♪
Attachments:
Similar questions
World Languages,
3 months ago
Hindi,
3 months ago
Social Sciences,
3 months ago
English,
7 months ago
Geography,
7 months ago
Math,
11 months ago
English,
11 months ago