Assignment = Count For Loop
Code
/// Name: Sam Wilson
/// Period: 6
/// Program Name: Count For Loop
/// File Name: count4loop.java
/// Date Finished: 2/15/16
import java.util.Scanner;
public class count4loop
{
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 );
}
}
}
//n+1 is the count that tells when the code has repeated to that amount.
//int n = 1 defines the count
//
Picture of the output