CSS 562 WEEK 3 SUPPORTING ACTIVITY
Supporting Activity: Converting Loops
Convert the following program from a for loop to a while loop.
class ArithmeticProgression
{
public static void main (String [] args)
{
int sum = 0;
for (int i = 1; i <= 1000; i++)
{
sum = sum + i;
System.out.println(Integer.toString(sum));
}
}
}
Post your code and discuss under which circumstances each kind of loop would be more appropriate?
Pending
Other
/
Other
20 May 2017
Answers
Login/SignUp to view answers