Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner keyboard = new Scanner(System.in);
  7.  
  8.         int rNumber = 3;
  9.  
  10.         System.out.println("I have chose a number between 1 to 10. Try to guess it...");
  11.         System.out.println("Your Guess: ");
  12.         int entry = keyboard.nextInt();
  13.  
  14.         while ( entry != rNumber )
  15.         {
  16.             System.out.println("\nThat is incorrect! Guess again.");
  17.             System.out.println("Your guess: ");
  18.             entry = keyboard.nextInt();
  19.  
  20.         }
  21.  
  22.         System.out.println("\nThat's right! You're a good guesser");
  23.  
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement