Hi,
I have wrote a for loop that writes a program that asks the user to type in three numbers and then displays the total of those numbers
public class Forloop3_3a
{
public static void main(String[] args)
{
int num1;
int total = 0;
for (int i=1; i<=3; i++ ) {
System.out.print("Enter Numbers: ");
num1 = EasyIn.getInt();
total = total + num1;
}
System.out.println("Total is " + total);
}
}
How can i do this using a do...while loop? so that you can type in numbers continually until you want to finish
Thanks in advance


Reply With Quote


Bookmarks