write program in C plus plus to display the sum of two numbers take the two numbers as input from the user also show the output
Answers
Answered by
4
Answer:
In this program, user is asked to enter two integers. These two integers are stored in variables firstNumber and secondNumber respectively. Then, the variables firstNumber and secondNumber are added using + operator and stored in sumOfTwoNumbers variable. Finally, sumOfTwoNumbers is displayed on the screen.
Answered by
8
Question :
To write a program C++ to display the sum of 2 numbers.
Answer :
Required C++ Program :
• To find sum of 2 Numbers
#include <iostream>
Using namespace std;
int main ( )
{
int a,b,sum ;
cout <<" Enter 2 numbers :";
cin >> "a,>>";
sum = a + b ;
cout << " Sum of 2 numbers : "<<sum ;
return 0;
}
Output :
Enter 2 numbers : 4 7
Sum of 2 numbers : 11
Structure Of C++ Program :
// comment line
# include <iostream>
Using namespace std;
int main ( )
{
.......
Body of the Program ;
........
return 0;
}
Similar questions