Program #60

Code

   
    /// Name: Afaf Nabeeha
    /// Period: 7
    /// Program Name: Counting with a While Loop
    /// File Name: Counting.java
    /// Date Finished: 12/9/2015 public class Counting

        import java.util.Scanner;
        
        public class Counting
        {
            public static void main( String[] args )
            {
                Scanner keyboard = new Scanner(System.in);
                
                System.out.println( "Type in a message, and I'll display it several times. " );
                System.out.print( "Message: " );
                String message = keyboard.nextLine();
                System.out.print( "How many times? " );
                int m = keyboard.nextInt();
                int n = 0;
                while (n < m )
                {
                    System.out.println( (10*n + 10) + ". " + message );
                    n++;
                }
            }
        }
                     
    

Picture of the output

Assignment 63