68 338
Assignments Done
98,8%
Successfully Done
In November 2018

Answer to Question #15267 in AJAX | JavaScript | HTML | PHP for karen fetrow

Question #15267
Convert the following program from for loop to 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));
}
}
}
Expert's answer
class ArithmeticProgression
{
public static void main (String [] args)
{
int sum = 0;
int i = 1;
while(i <= 1000)
{
sum = sum + i;
System.out.println(Integer.toString(sum));
i++;
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions