Advertisement
daca123

Untitled

Nov 19th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 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.         for ( int n = 2 ; n <= 10 ; n = n+2 )
  14.         {
  15.             System.out.println( n + ". " + message );
  16.         }
  17.  
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement