Computer Science, asked by biswasyashika, 5 months ago

Write Program in C++ to display the sum of two numbers. Take the two numbers as input from the user. Also show the output.​

Answers

Answered by Anonymous
8

Explanation:

#include <iostream>

using namespace std;

int main()

{

int firstNumber, secondNumber, sumOfTwoNumbers;

cout << "Enter two integers: ";

cin >> firstNumber >> secondNumber;

// sum of two numbers in stored in variable sumOfTwoNumbers

sumOfTwoNumbers = firstNumber + secondNumber;

// Prints sum

cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

return 0;

}

Answered by dreamrob
2

Program:

#include<iostream>

using namespace std;

int sum(int a , int b)

{

return a + b;

}

int main()

{

int a , b;

cout<<"Enter first number : ";

cin>>a;

cout<<"Enter second number : ";

cin>>b;

cout<<a<<" + "<<b<<" = "<<sum(a , b);

return 0;

}

Output:

Enter first number : 34

Enter second number : 87

34 + 87 = 121

Similar questions