Assignemnt #63
Code
/// Name: Holden Ganch
/// Period: 7
/// Program Name: sixty third Program
/// File Name: CountingWhile.java
/// Date Finished: 12/9/2015
import java.util.Scanner;
public class CountingWhile
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Type in a message, and I'll display it ");
System.out.print("Message: ");
String message = keyboard.nextLine();
System.out.print("How many times would you like me to display this message.");
int x = keyboard.nextInt();
int n = 0;
while ( n < x )
{
System.out.println( ((n+1)*10) + ". " + message);
n++; // Without it it just doesnt change the number but stays on 1
}
}
}
Picture of the output