Assignment # 78 and Counting with a For Loop

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: CountingFor
    /// File Name: CountingFor.java
    /// Date: 1/28/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=2; n<=20; n=n+2)
        {
            System.out.println(n + ". " + message);
        }
        ///n=n+1 numbers the list of the message repeating.
        ///int n=1 is the first number that it starts counting from.
        ///changing n<=5 to n<=10 makes the code repeat the message 10 times but if you change n=2 then it's necessary to change n<=20 to repeat the message ten times since it's counting by 2's now.
    }
}
  
   
   
   

  

Picture of the output

Assignment 78