Assignemnt #78 and Counting For
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Counting For
/// File Name: CountingFor.java
/// Date Finished: 1/13/2015
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 ten times.");
System.out.print("Message: ");
String message = keyboard.nextLine();
for ( int n = 2 ; n <= 10; n = n + 2 )
System.out.println( n + ". " + message );
//1. n=n+1 makes n bigger each time so that the loop can end when n = 5
//2. int n = 1 declairs the variable n
}
}
Picture of the output