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