Home › C++ Tutorial › C++ how to: add two numbers
C++ how to: add two numbers
Read two numbers and add.
Read with cin and print the sum.
Example code
#include <iostream>
using namespace std;
int main() {
int a, b;
cout << "Two numbers: ";
cin >> a >> b;
cout << "Sum = " << a + b << endl;
return 0;
}