INSTRUCTION: Read and study the assignment below. Solve the problem using C++ programming language, compile, run and screen shot the correct output. Copy and paste the source code or program code and the required sample output (screen shot) in the format below. Write a program using RETURNING VALUES FROM FUNCTION that will display the sum, product, difference, quotient and modules of two numbers. Note: Create function name for sum, product, difference,quotient and modulus. Complete the program codes below to finished the problem requirements. SAMPLE OUTPUT: Enter first number: 7 Enter second number: 2 The sum is 9 The product is 14 The difference is 5 The quotient is 3 The modulus is 1 SOURCE CODE: Update the source code below include using namespace std; int addTwoNumbers(int , int); // function name for sum // Create function name for product // Create function name for difference // Create function name for quotient // Create function name for modulus int num1, num2, sum=0; // global variable main() { cout<<”Enter first number: “; cin>> num1; cout<<”Enter second number: “; cin>> num2; sum= addTwoNumbers(num1, num2); cout<<"The sum is "<< sum; }//end of main //Calling Function addTwoNumbers int addTwoNumbers (int a, int b) { sum= a + b; return sum; // return value using RETURN keyword } OUTPUT: SCREENSHOT AND PASTE YOUR OUTPUT HERE
INSTRUCTION: Read and study the assignment below. Solve the problem using C++
Write a program using RETURNING VALUES FROM FUNCTION that will display the sum, product, difference, quotient and modules of two numbers.
Note: Create function name for sum, product, difference,quotient and modulus.
Complete the program codes below to finished the problem requirements.
SAMPLE OUTPUT:
Enter first number: 7
Enter second number: 2
The sum is 9
The product is 14
The difference is 5
The quotient is 3
The modulus is 1
SOURCE CODE: Update the source code below
include<iostream>
using namespace std;
int addTwoNumbers(int , int); // function name for sum
// Create function name for product
// Create function name for difference
// Create function name for quotient
// Create function name for modulus
int num1, num2, sum=0; // global variable
main()
{ cout<<”Enter first number: “;
cin>> num1;
cout<<”Enter second number: “;
cin>> num2;
sum= addTwoNumbers(num1, num2);
cout<<"The sum is "<< sum;
<insert your codes here>
}//end of main
//Calling Function addTwoNumbers
int addTwoNumbers (int a, int b)
{ sum= a + b;
return sum; // return value using RETURN keyword
}
OUTPUT: SCREENSHOT AND PASTE YOUR OUTPUT HERE
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images