Question: Write a small program to print the sum of the integers between m and n, inclusive, where m and n are constants. With m of

Write a small program to print the sum of the integers between m and n, inclusive, where m and n are constants. With m of 1 and n of100, your prog should print 5050. Modify the program to use scanf to read the two limiting values and to behave sensibly even if m >=n.

-Use a for loop to compute the sum

-Use scanf to read the two limiting values, rather than program constants,

-Create two function besides the main function. One function should be passed the values of m and n, and return the sum of the integers between them, inclusive. The sum should then be passed to the other function which will print it.

-Place the two function prototypes locally inside of the main() function

-Use local variables, rather than global variables

-Have the program continue to prompt the user for input using while loop until they enter valid input values, i,e mn and m=n.

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!