Simple CPP Program
Simple CPP Program
This C++ program takes two numbers as input from the user, adds them, and displays the result.
#include <iostream>
using namespace std;
int main() {
int num1, num2, sum;
cout << "The sum of " << num1 << " and " << num2 << " is " << sum << "." << endl;
return 0;
}
1. Copy the code into a C++ IDE or text editor (e.g., Code::Blocks, VS Code).
./program
Sample Output:
Enter the first number: 5
Enter the second number: 10
The sum of 5 and 10 is 15.