CountingWhile

Code

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 five times." );
		System.out.print( "Message: " );
		String message = keyboard.nextLine();

		int n = 0;
		while ( n < 10 )
		{
			System.out.println( ((n+1)*10) + ". " + message );
			n++;
		}
        
        System.out.println( " the code breaks if you take out the n++ " );

	}
}

CountingWhile

Assignment 63