c++ programming

#include <iostream>

using namespace std;

// Function to calculate the sum of two numbers
int add(int a, int b) {
    return a + b;
}

int main() {
    // Declare and initialize variables
    int num1, num2;

    // Prompt user for input
    cout << "Enter the first number: ";
    cin >> num1;

    cout << "Enter the second number: ";
    cin >> num2;

    // Call the add function and store the result in a variable
    int sum = add(num1, num2);

    // Display the result
    cout << "The sum of " << num1 << " and " << num2 << " is: " << sum << endl;

    return 0;
}