Assignemnt #63 Counting With A While Loop

Code

   
    /// Name: Jake Johnson
    /// Period: 7
    /// Program Name: CountingWithAWhileLoop
    /// File Name: CountingWithAWhileLoop.java
    /// Date Finished: 12/7/2015
    
import java.util.Scanner;

public class CountingWithAWhileLoop
{
	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();
        System.out.print( "How many times? " );
        int times = keyboard.nextInt();
        
		int n = 0;
		while ( n < times )
		{
			System.out.println( (10*(n+1)) + ". " + message );
            n++; //n++ adds 1 to the value of n so that the loop won't run infinitely
		}

	}
}

    

Picture of the output

This should work