Assignemnt 78 and Counting With For Loop

Code

    /// Name: Xinting Chen
    /// Period: 7
    /// Program Name: Counting With For Loop
    /// File Name: CountingWithForLoop.java
    /// Date Finished: 2/4/2016
  
    import java.util.Scanner;
    public class CountingWithForLoop
    {
        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 );
            }
    
        }
    }
    //If you remove  n=n+1 then the program will keep going forever.
    //If you remove int n=1 then there is no initialization for n. 
                    
            


    

Picture of the output

Assignment 78