Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program 1: Design a program in C which, when executed, will do the following in the indicated sequence: Ask the user to type on the

Program 1:

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

Ask the user to type on the keyboard a user-supplied positive integer number nstart.

Ask the user to type on the keyboard a user-supplied larger ending positive integer number nstop.

The program will then compute for one time only, using the while looping command, the value of the function called zNo(nstart,nstop) which is defined as the sum of the squares of all the integers lying between and including nstart and nstop, i.e.,

zNo(nstart,nstop) = nstart2 + (nstart+1)2 + (nstart+2)2 + + (nstop-1)2 + nstop2.

As an example, let nstart=2 and nstop=5, then zNo(2,5)=22+32+42+52=4+9+16+25=54.

The program is then to display on the console the user-supplied values of nstart and nstop as well as the corresponding value of zNo(nstart,nstop) in the format shown below:

nstart=3, nstop=5 ====> zNo(3,5)=54.

For your sample output, use the values nstart=3 and nstop=5.

Draw a flow chart corresponding to this program. 3 POINTS

Program 2:

Modify program 1 above so that it computes and then displays on the console computations of zNo(nstart,nstop) for user-specified values of nstart and nstop as in Program 1 but now in an infinite loop.

Do three sample outputs corresponding to the following values of nstart and nstop:

SAMPLE OUTPUT 1: nstart=1, nstop=3

SAMPLE OUTPUT 1: nstart=2, nstop=4

SAMPLE OUTPUT 1: nstart=3, nstop=5.

Draw a flow chart corresponding to Program 2. 3 POINTS

Program 3:

Modify program 1 above so that it computes and then displays on the console computations of zNo(nstart,nstop) for user-specified values of nstart and nstop as in Program 1 but now for a user-specified number of times denoted ntimes. For your sample output, use ntimes=3, with the three sets of values of nstart and nstop as in Program 2.

Draw a flow chart corresponding to Program 3. 4 POINTS

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

What is the inflation tax?

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago