Assignemnt #63 Counting with a While Loop

Code

    ///Name: Prooz Fereydouni
    ///Period: 7
    ///Project Name: Counting with a While Loop
    ///File Name: CountingWhile.java
    ///Date: 12/10/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 a number, and I'll display the message as many times as you want." );
		System.out.print( "Message: " );
		String message = keyboard.nextLine();
        System.out.print( "Number: " );
		int m = keyboard.nextInt();

		int n = 0;
		while ( n < m )
		{
			System.out.println( ((n+1)*10) + ". " + message );
            //n++ adds one to the n and makes it closer and closer to the number used in the while statement so that the program would terminate when it reaches the number and if this command is removed the program runs forever.
			n++;
		}

	}
}



    

Picture of the output

assignment63