Assignemnt #63
Code
///colin hinton
///5th period
///Counting
///Counting.java
///11/4/2015
import java.util.Scanner;
class Counting
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.println( "Type in a message, and I'll display it several times." );
System.out.print( "Message: " );
String message = keyboard.nextLine();
System.out.print("How many times: ");
int demand = keyboard.nextInt();
int n = 0;
while ( n < demand )
{
System.out.println( ((n + 1)* 10) + ". " + message );
n++;
// The n++ adds one to the value of n after running the program everytime. By doing so it helps it reach 5.
}
}
}
Picture of the output