Computer sciences and Information technology

Computer sciences and Information technology

Project description

Our focus this week is loops.

Select and complete one of the following activities:

(1) 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));

}

}

}

(2) Compare the efficiency between a for loop and a while loop in the same program. Your program should be able to tell if a for loop is faster than a while-loop at the end of the program.

Place this order with us and get 18% discount now! to earn your discount enter this code: special18 If you need assistance chat with us now by clicking the live chat button.

© 2020 customphdthesis.com. All Rights Reserved. | Disclaimer: for assistance purposes only. These custom papers should be used with proper reference.