eguruchela

FAQ : Computer>C program

Write a C++ Program to add two integers

C++ Program

#include <iostream> using namespace std; int main() { int num1, num2, numsums; cout << "Enter two integers: "; cin >> num1 >> num2; // sum two numbers in stored in variable numsums numsums = num1 + num2; // Prints sum cout << num1 << " + " << num2 << " = " << numsums; return 0; }

Output

Enter two integers: 18 8 18 + 8 = 26

Previous Page        Next Page

Programing with C