Tuesday, July 28, 2020

Write a Program to Add Two Integers in C++.

Add Two Integers in C++.

#include <iostream>
using namespace std;

int main()
{
    int fst, sec, sum;
    cout << "Enter two integers ::\n ";
    cin >> fst >> sec;
    sum = fst + sec;
    cout << fst << " + " <<  sec << " = " << sum;     

    return 0;
}

OUTPUT

Enter two integers ::
 5
 5
5 + 5 = 10

No comments:

Post a Comment

Please do not any spam link in Comment Box