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); }
Comments
Leave a comment