Question: Problem 1 ( 2 0 points ) : Write an interactive C program that ask a user to enter an integer number that is greater

Problem 1(20 points): Write an interactive C program that
ask a user to enter an integer number that is greater than or equal to 0. Your program
will continue asking until a user enters a zero or a positive integer.
find, and print with 7 digits after a decimal point, the result of
112-123+134-145+cdots+(-1)N(N+1)(N+2)
, ask a user whether he/she wants to continue (n for No).
You must write and use, in your code, the following function: double myfunc(int N);
The function is used to calculate and return the result of the series given above.
For example, when N=5, the result is
112-123+134-145+156-167=0.3761905
Sample code execution: bold text indicates information entered by a user
Enter an integer 0:-1
Enter an integer 0:-100
Enter an integer 0:-2
Enter an integer 0:-5
Enter an integer 0:0. for N =0, sum of series is 0.5000000
Do you want to continue (n for No)? y
Enter an integer >=0: 5
for N =5, sum of series is 0.3761905
Do you want to continue (n for No)? s
Enter an integer >=0: -2
Enter an integer >=0: 234
for N =234, sum of series is 0.3863033
Do you want to continue (n for No)? a
Enter an integer >=0: 9999
for N =9999, sum of series is 0.386294
Do you want to continue (n for No)? q
 Problem 1(20 points): Write an interactive C program that ask a

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!