Answer:
In C++:
#include <iostream>
using namespace std;
int add(int a, int b){
int c = a + b;
return c;
}
int main(){
int a, b;
cout<<"Enter two numbers: ";
cin>>a;
cin>>b;
cout<<add(a,b);
return 0;
}
Step-by-step explanation:
The add() function begins here
int add(int a, int b){
This adds the two integers
int c = a + b;
This returns the sum of the two integers
return c;
}
The main begins here
int main(){
This declares two numbers
int a, b;
This prompts user for two numbers
cout<<"Enter two numbers: ";
The next two lines gets the two numbers
cin>>a;
cin>>b;
This gets the sum of the two numbers from the add() function. The sum is also printed
cout<<add(a,b);
return 0;
}