Assignemnt #63 and Counting with a While Loop
Code
///Name: Luke Shin
///Period: 7
///Project Name: loop
///File Name: loop.java
///Date: 12/11/2015
import java.util.Scanner;
public class loop
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
System.out.println( "Type in a message, and I'll display it five times." );
System.out.print( "Message: " );
String message = keyboard.nextLine();
int times = 0;
System.out.print("How many times?: ");
times = keyboard.nextInt();
int n = 0;
while ( n < times )
{
System.out.println( (n+1)*10 + ". " + message );
n++;
}
}
}
Picture of the output