Answer to Question #69475 in C++ for ,Kelvin

Question #69475
C++ program with a function that takes two int parameters, adds them together, then returns the sum. The program should ask the user for two numbers, then call the function with the numbers as arguments, and tell the user the sum.
1
Expert's answer
2017-08-08T06:51:10-0400
Answer:
#include <iostream>

using namespace std;

int a,b;

int sum(int a, int b){
return a+b;
}

int main(){
cout << "Please, enter two numbers" << endl;
cin >> a >> b;
cout << sum(a,b);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS