Question: // This program uses a function that returns a value. #include using namespace std; // Function prototype int sum(int, int); int main() { int value1

// This program uses a function that returns a value. #include using namespace std;

// Function prototype int sum(int, int);

int main() { int value1 = 20, // The first value value2 = 40, // The second value total; // To hold the total

// Call the sum function, passing the contents of // value1 and value2 as arguments. Assign the return // value to the total variable. total = sum(value1, value2); // Display the sum of the values. cout

//***************************************************** // Definition of function sum. This function returns * // the sum of its two parameters. * //*****************************************************

int sum(int num1, int num2) { return num1 + num2; }

// This program uses a function that returns a value. #include using

using the template above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!