Assignemnt #63
Code
/// Name: Ryan Volko
/// Period: 7
/// Program Name: CountingWhile
/// 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 five times." );
System.out.print( "Message: " );
String message = keyboard.nextLine();
System.out.print( "How many times should I print it. ");
int x = keyboard.nextInt();
int n = 0;
while ( n < x )
{
System.out.println( ((n+1)*10) + ". " + message );
n++;
///the n++ makes the number go from 1 to 2 and 3 to 4 and so on
}
}
}
Picture of the output