Assignemnt #78 Counting with a For Loop

Code

    ///Name: Prooz Fereydouni
    ///Period: 7
    ///Project Name: Counting with a For Loop
    ///File Name: CwaFL.java
    ///Date: 2/4/2016
  
import java.util.Scanner;

public class CwaFL
{
    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 <= 20 ; n = n+2 ) // int n=1 introduces the integer which is going to help the for loop repeat itself for that many times, and n= n+ 1 will add 1 to n for every time the message is shown so that it will eventually reach the number which is introduced in the for statement to stop the loop.
        {
            System.out.println( n + ". " + message );
        }

    }
}


    

Picture of the output

assignment78