Assignment #63 and Counting While
Code
//Name: Mark Katz
///Period: 6
///Program Name: Counting While
///File Name: CountingWhile.java
///Date Finished: 10/26/15
import java.util.Scanner;
public class CountingWhile
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int n=0, number;
System.out.println( "Type in a message, and I'll display it ten times." );
System.out.print( "Message: " );
String message = keyboard.nextLine();
System.out.print( "How many times? " );
number = keyboard.nextInt();
while ( n < number )
{
System.out.println( (n+1)*10 + ". " + message );
n++;
}
}
}
//removing the 'n++" makes the program go on forever
Picture of the output