Designing and testing the functionality of the following


Designing and testing the functionality of the following four programs:

Program 1:

Design a program in C which, when executed, will do the following in the indicated sequence:

1. Ask the user to type on the keyboard a user-supplied value of a positive integer number n.

2. The program will then compute, for one time only, using the "for" looping command, the value of what is called here the zNo(n) defined as the series
zNo(n) = 1x2 + 2x3 + 3x4 + ...+ (n-1)xn.

3. The program is then to display on the console the user-supplied value of nas well as the corresponding value of tNo(n) in the format shown below:
n=3===>zNo(3)=20.
Produce two sample outputs, one for n=3 and the other for n=5.

Program 2:
Modify program 1 above using "while" looping so that it computes and then displays on the console computations of zNo(n) for auser-specified value of n as in Program 1 but now in an infinite loop. Your sample output is to display values of n and zNo in the same format as in Program 1 but for the following 5 values of n:
n=2, 3, 4, 5, and 6.

Program 3:
Modify program 1 above using "while" looping so that it computes and then displays on the console computations of zNo(n) for a user-specified valueof n as in Program 1 but now for a user-specified number of timescalled ntimes. Your sample output is to display values of n and zNo in the same format as in Program 1 for the same 5 values of n as in Program 2.

Program 4:
Modify program 1 above using "while" looping so that it computes and then displays on the console computations ofzNo(n) for equally spaced values of n from and including a user-specified starting value of n called nstart to a user-specified ending value of n called nstop, with user-specified equal increment from one value of n to the next value of n called nstep. The output in the present program is to be displayed as a 2-column table with the first column being n and the second column being zNo. The two columns in this table are to be 16 digits wide and the values of n and zNo are to be left justified within the columns. In your computations, use nstart=3, nstop=8 and nstep=2.

Solution Preview :

Prepared by a verified Expert
Electrical Engineering: Designing and testing the functionality of the following
Reference No:- TGS01601213

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)