Assignment #63 Counting with a While Loop
Code
///Name: Ian Grant
///Period:5
///Project Name: Counting with a While Loop
///File Name:CountWhile.java
///11/12/15
import java.util.Scanner;
public class CountWhile
{
public static void main(String[] args)
{
Scanner stuff= new Scanner(System.in);
System.out.println("Type in a message, and I''ll display it five times.");
System.out.print("Message: ");
String message=stuff.nextLine();
int n=1;
while(n< 11)
{
System.out.println((n*10)+". "+message);
//Increases the value of n so the loop ends.
n++;
}
}
}
Output