Counting with a For Loop

Code

    /// Name: Rachel Smith
    /// Period: 5
    /// Program Name: Counting with a For Loop
    /// File Name: CountingFL.java
    /// Date Finished: 12/10/2015
    
    import java.util.Scanner;
    
    public class CountingFL
    {
        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 = 2 ; n <= 10 ; n = n+2 )
            {
                System.out.println( n + ". " + message );
            }
            
            /// The n = n+1 tells the computer how many times the message has been displayed by adding 1 to n every time it is printed.
            /// The n = 1 tells the computer what to print n as. It also defines how many times the message has been printed.
    
        }
    }

    

Picture of the output

Assignment 1