Advertisement
CamiloCastilla

Untitled

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