Assignment #63 and Counting With
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Counting With
/// File Name: CountingWith.java
/// Date Finished: 09/13/2015/
import java.util.Scanner;
public class CountingWith
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int input;
System.out.println( "Type in a message, and I'll display it several times." );
System.out.print( "Message: " );
String message = keyboard.nextLine();
System.out.println( "how many times do you want me to repeat it?");
System.out.print( "> ");
input = keyboard.nextInt();
int n = 0;
while ( n < input )
{
System.out.println( ((n+1)*10) + ". " + message );
n++;
}
/// When the "n++;" gets taken away, the n value never increases so it stays at 1 always completing the while loop so it repats forever.
}
}
Picture of the output