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.

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by thines01

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.