Assignemnt #78 and Counting with a For Loop
Code
/// Name: Marco Correa
/// Period: 5
/// Program Name: Counting with a For Loop
/// File Name: Counting with a For Loop.java
/// Date Finished: 1/20/2016
import java.util.Scanner;
public class CountingForLoop
{
public static void main( String[] args )
{
Scanner k = new Scanner(System.in);
System.out.println( "Type in a Message and I will display if five times." );
System.out.print( "Message: " );
String m = k.nextLine();
for ( int n = 2; n <=10; n += 2 )
{
System.out.println( n + ". " + m );
}
}
}
Picture of the output