C++ Online Compiler
Example: Direct Addition of Two Integers in C++
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// Direct Addition of Two Integers #include <iostream> using namespace std; int main() { // Step 1: Declare and initialize two integer variables int number1 = 10; int number2 = 25; // Step 2: Declare a variable to store the sum int sum; // Step 3: Perform direct addition sum = number1 + number2; // Step 4: Display the result cout << "The sum of " << number1 << " and " << number2 << " is: " << sum << endl; return 0; }
Output
Clear
ADVERTISEMENTS