In: Computer Science
Re-write following while loop into Java statements that use a Do-while loop. Your final code should result in the same output as the original code below.
int total = 0;
while(total<100) { System.out.println("you can still buy for"+(100-total)+"Dollars"); total=total+5; }

int total = 0;
do {
System.out.println("you can still buy for" + (100 - total) + "Dollars");
total = total + 5;
} while (total < 100);

public class WhileToDoWhile {
public static void main(String[] args) {
int total = 0;
do {
System.out.println("you can still buy for" + (100 - total) + "Dollars");
total = total + 5;
} while (total < 100);
}
}
