Assignment #78 and Counting With a For Loop

Code

                        /// Name: Graham Pollock
                        /// Period: 5
                        /// Program Name: Counting For Loop
                        /// File Name: CountingFor.java
                        /// Date Finished: 02/03/2016/

    import java.util.Scanner;
        
        public class CountingFor
        {
            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();
        
                for ( int n = 1 ; n <= 10 ; n = n+1 )
                {
                    System.out.println( (n*2) + ". " + message );
                }
        
            }
        }
        ///removing the 'n = n + 1' makes n stay at 1 forever, so the the loop never terminates
        ///the 'int n = 1' declares and initializes the varibale n
        
    

Picture of the output

Assignment