Assignment 63, Counting With A While Loop
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Message Num
///File Name: MessageNum.java
///Date Finshed: 12/14/15
import java.util.Scanner;
public class MessageNum
{
public static void main( String[] args )
{
Scanner siri = new Scanner(System.in);
System.out.println( "Type in a message, and I'll display it 10 times." );
System.out.print( "Message: " );
String message = siri.nextLine();
System.out.print("How many times: ");
int t = siri.nextInt();
int n = 0;
while (n < t)
{
System.out.println( (10*(n+1)) + ". " + message );
n++; //n++ doesn't make my code break powershell???
}
}
}
Picture of the output