Assignment 78

code

 ///Name: Mutsu Osoegawa
///Period: 7
///Project Name: Counting with a For Loop
///File Name: CountingForLoop.java
///Date: 2/9/2016

import java.util.Scanner;
public class CountingForLoop
{
    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  )
            //Removing n = n + 1 will make the for loop run for infinity, because n will not reach 5. 
            //n = 1 gives n a value, not putting it in will not make the program run. 
        {
            System.out.println( n + ". " + message );
        }
        
    }
}