Question: Exercise 10. (40 Points) For this exercise you will w rite two small C programs. Both programs will prompt the user for an integer n

 Exercise 10. (40 Points) For this exercise you will w rite

Exercise 10. (40 Points) For this exercise you will w rite two small C programs. Both programs will prompt the user for an integer n from the command line, read it in, check that it is indeed an integer, and print a confirmation of the number from main, then call a function to compute the sum from 1...n. If n is not an integer the program should terminate with an appropriate message upon checking n (and therefore not proceed or call any functions.) The first program will be named BruteForceAdder.c. After printing n, the main function of BruteForceAdder.c will call a function named BruteForceAdder and pass this function n. The function BruteForceAdder will print a message to the screen telling the user that it has begun adding the numbers from 1 to n. This function will then proceed to add the numbers from 1 to n the brute force way: in a loop. The program will print the sum with a nice, descriptive message, and terminate The second program will be named GaussAdder.c. After printing n, the main function of GaussAdder.c will call a function named GaussAdder and pass this function n. The function GaussAdder will print a message to the screen telling the user that it has beguin adding the numbers from 1 to n. This function will then proceed to add the numbers from 1 to n the Gaussian way: n n1 i= I The program will print the sum with a nice, descriptive message, and terminate

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!