Program is, Write a small program to print the sum of the integers between Mand
ID: 3619179 • Letter: P
Question
Program is,Write a small program to print the sum of the integers between Mand N, inclusive, where M and N are program constants. With an M of1 and an N of 100, your program should print 5050.
Modify the program to use scanf to read the two limiting values andto behave sensibly even if M >= N.
Use a FOR loop to compute the sum.
Use scanf to read the two limiting values, rather than programconstants.
Create two functions, besides the main function. One functionshould be passed the values of m and n, and return the sum of theintegers between them inclusive. This sum should then be passed tothe other function which will print it. What would some good(meaningful) names be for these functions? Remember to use localvariables, rather than global variables, if needed.
Have the program continue to prompt the user for input using awhile loop until they enter valid input values, i.e., m<n. Makesure that your printed output demonstrate this error check byincluding test runs for both m>n and m=n.
Thank you for your help for looking into it.
Explanation / Answer
please rate - thanks #include #include int main() {int i,m,n,sum; printf("Enter a starting value: "); scanf("%d",&m); printf("Enter an ending value: "); scanf("%d",&n); while(m>=n) {printf("starting value must beRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.