Please utilize Java Change the below while loop into a for l

Please utilize Java

Change the below while loop into a for loop:

double total = 100

int amount = 500

while

(count > 0) ( total = total + amount;

amount --; )

Solution

in while loop you definitely decrease the count other wise it will go into infinity loop.

Hear you doesnot initilize the count other wise it show the error.

Program:-

double total = 100

int amount = 500

int count = 10;

for(int i = count ; i > 0; i--){

total = total + amount;

amount --;

}

Please utilize Java Change the below while loop into a for loop: double total = 100 int amount = 500 while (count > 0) ( total = total + amount; amount --; )

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site