C++ Program to Add Two Integer Numbers Provided by User

In this program, the user is asked to enter two integer numbers. After that the sum of these two integers is calculated and displayed on the console.



Source Code
#include<iostream>
using namespace std;

int main()
{
    int num1, num2, sum;    // Declaration
    cout<<"Enter any two numbers: ";
    cin>>num1>>num2;   // Read 2 numbers

    sum = num1 + num2;  // Formula for addition
    cout<<"First number: "<<num1;
    cout<<"\nSecond number: "<<num2;
    cout<<"\nAddition is: "<<sum; // Print result
    return 0;
}
Output
Enter any two numbers: 15 75
First number: 15
Second number: 75
Addition is: 90