Home » Blog » Add Two Numbers

Add Two Numbers

In this program, two integer values taken from user and then sum of this values are stored in another variavle and then print it.

#include <iostream>
using namespace std;

int main()
{
    int firstNo, secondNo, sumOfTwoNo;
    
    cout << "Enter two integer values: ";
    cin >> firstNo >> secondNo;

    sumOfTwoNo = firstNo + secondNo;

    cout << firstNo << " + " <<  secondNo << " = " << sumOfTwoNo; 
    
    return 0;
}

OutPut

Enter two integer values: 4
5
4 + 5 = 9

 

Leave a Reply

Your email address will not be published.