Assignemnt #63 and counting with a while loop
Code
///name: nick cerdan
///period: 6
///program name: counting with a while loop
///file name: CountingWhile.java
///date finished: 10/21/15
import java.util.Scanner;
public class CountingWhile
{
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 i take away the "n++;" the n value never increases so it stays at 1 always fufilling the while loop so it repats forever
}
}