Assignemnt #63 and Counting with a While Loop
Code
/// Name: Marco Correa
/// Period: 5
/// Program Name: CountingWhile
/// File Name: CountingWhile.java
/// Date Finished: 12/15/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 the a message, and I'll display it five times." );
System.out.print( "Message: " );
String message = keyboard.nextLine();
System.out.print( "How many times? " );
int user_end = keyboard.nextInt();
int n = 0;
while ( n < user_end )
{
System.out.println( ((n + 1) * 10) + ". " + message );
n++;
}
}
}
Picture of the output