C++ Program to Add Two numbers


In this Example, You will learn how to Add Two numbers in C++.


20 = 10 + 10

40 = 20 + 20


Example: How to Add Two numbers in C++

Run it Now
#include<iostream>
using namespace std;

int main() {

    int x, y, s;

    cout << "Enter two numbers :";
    cin >> x >> y;

    s = x + y;

    cout << "\nThe sum of two numbers is :" << s;

    return 0;
}

Output:

Enter two number : 12 12
The sum of two number is :24