logo image

C++ program to take two numbers from user and add those two numbers

Views: 13

Following program shows you how to take two numbers from user and add those two numbers. In this program we take two numbers from user using std::cin method and add those two numbers

#include <iostream>
int main() {
	int input1;
	int input2;

	std::cout << "Enter first number:";
	std::cin >> input1;

	std::cout << "Enter second number:";
	std::cin >> input2;

	int result = input1 + input2;

	std::cout << "Sum of the given two numbers is: " << result;
}

Output:

Enter first number: 20
Enter second number: 2
Sum of the given two numbers is: 22 
We are looking for Interns!
Send your resumes to
[email protected]