Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main
  4. {
  5.     public static void main( String[] args )
  6.     {
  7.         Scanner keyboard = new Scanner(System.in);
  8.  
  9.         System.out.println( "Type in a message, and I'll display it five times." );
  10.         System.out.print( "Message: " );
  11.         String message = keyboard.nextLine();
  12.  
  13.         int n = 0;
  14.         while ( n < 5 )
  15.         {
  16.             System.out.println( (n+1) + ". " + message );
  17.             n++;
  18.  
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement