Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 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.         int amount;
  10.  
  11.         System.out.println( "\n Type in a message, and I'll display it five times." );
  12.         System.out.print( "Message: " );
  13.         String message = keyboard.nextLine();
  14.  
  15.         System.out.println("\n How many times do you want to print your message?");
  16.         amount = keyboard.nextInt();
  17.  
  18.         int n = 0;
  19.         while (n < (amount*10))
  20.         {
  21.             System.out.println( (n+10) + ". " + message );
  22.             n = n + 10;
  23.         }
  24.  
  25.         System.out.println("\n We have printed your message "+amount+ " times. See you next time!");
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement