Question: Using C++ Write a programmer defined function with void return type that calculates the sum of integers from 1 to a user defined integer. For
Using C++
Write a programmer defined function with void return type that calculates the sum of integers from 1 to a user defined integer. For example, if the user defined integer is 10, the function needs to add from 1 to 10. Your function will accept two parameters: an integer to compute the sum up to and a long integer to store the calculated sum. You need to ask the user for the value of the integer, pass it to your function and compute the sum in your function. Display the sum in your main function.
HINT: Think whether you need to pass by value or reference.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
