In this program, user is asked to enter two integers. Then, the sum of those two integers is stored in a variable and displayed on the screen. Primary tabs.
#include <iostream.h>
#include <conio.h>
int main()
{
    int No1, No2, Ans;
    cout << "Enter two integers: ";
    cin >> No1 >> No2;
    Ans = No1 + No2;
    cout << No1 << " + " <<  No2 << " = " << Ans;
    getch();
}
Enter two integers: 4   5
4 + 5 = 9
Advertisements
Advertisements
Advertisements