Shopping Cart
Your shopping cart is empty!

PRG 420 Week 3 DQ 1

PRG 420 Week 3 DQ 1
Model:Recent
Price: $3.00 $2.00
Qty:   Check out
This Tutorial Purchased: 6  Times.  Tutorial Rating: A

attachments This Tutorial contains following Attachments:

  • Week 3 - DQ 1.doc

PRG 420 Week 3 DQ 1

 

Select and complete one of the following activities:

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));
}
}
}

 

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. Include the result of your run with the information on which one is faster.

Write a review

Your Name:


Your Review: Note: HTML is not translated!

A   B   C   D   F  

Enter the code in the box below:



UOP Assignments ©2019, All Rights Reserved

Top