C++ Online Compiler
Example: C++ Program to Find the Sum of Two Integers
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ program to find the sum of two integers #include <iostream> using namespace std; // It's the main function of the program int main() { int p, q, r; // Step-1 Take inputs from the user cout << "Enter two integer values::\n"; cin >> p >> q; // Step-2 Calculating the sum of input numbers r = p + q; // Step-3 Final output of the program cout << "Result:: " << p << " + " << q << " = " << r << endl; return 0; }
5 7
Output
Clear
ADVERTISEMENTS