2. Write a statement or a set of statements to accomplish each of the following:
a. Sum the odd integer between 1 and 99 using a while statement. Assume that variables sum and count have been declared as Integers.

b. Sum the squares of the even integers between 1 and 15 using a Do While…Loop repetition statement. Assume that the Integer variables sum and count have been declared and initialized to 0 and 2

c. Print the number from 20 to 1 to the command prompt using a Do Until…Loop and Integer counter variable counterIndex. Assume that the variable counterIndex is initialized to 20

d. Repeat above exercise using Do While…Loop statement.

Recommended Answers

All 4 Replies

is it your class assignment or homework ?

my assignment

then please do some effort , after that if you have any prob then we are here to help you :) , with out effort there is no learning .

Which part is giving you the trouble?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.