Question: program to be answered in C. please paste the code, thanks! CS 153 Program 3 - Sums (easy loop practice) 1. Write a pure function

 program to be answered in C. please paste the code, thanks!

program to be answered in C. please paste the code, thanks!

CS 153 Program 3 - Sums (easy loop practice) 1. Write a pure function int sumeloop int Ni that computes sum of Integers from 1 to N: Sum - 1+2+3+4+...+(n-1)+N Do this the obvious way by initializing a sum to zero and then adding up the integers using a loop. Now write a pure function int suformulatint that uses the familiar formula to compute the same thing. ( +1) 2. Now write a pure function sun Squaresloopfint sumn for integers 1 to N: that computes the Sum=1+2+3+ +(n-1)+n? Do this the obvious way by initializing a sum to zero and then adding up the squares of integers using a loop. that uses the Now write a pure function int sumquaresformulatint formula to compute the same thing. (x + 1)(2+1) 3. Now write a pure function sunCubesloop(int n) that computes the sum n' for integers 1 to N: Sum=1+2+3+...+(n-1)+n? Do this the obvious way by initializing a sum to zero and then adding up the cubes of integers using a loop. that uses the Now write a pure function int sumCubesformula(int N formula to compute the same thing. 4. Write a main function that asks the user for N, and then prints out six Sums as computed by each of the above six functions. Of course, the corresponding pairs should compute the same value. Do all I/O in main The functions themselves should not do I/O. Don't do error checking. Just let overflow happen for large N. C:\Source Enter N->75 sum I to N loopt 2850, formula: 2850 loop: 143450; formula 143450 su 1 to 3 loop: 8122500) formulat 8122500 C:Source Use ANSI-C syntax. Compile and run using the goc environment. Do not mix tabs and spaces in the source file. Debug thoroughly. Turn in a complete source file using Blackboard

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!