Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- int pin = 3;
- System.out.println("I have chosen a number between 1 and 10");
- System.out.print("Your guess: ");
- int entry = keyboard.nextInt();
- while (entry != pin) {
- System.out.println("That is incorrect");
- System.out.print("Guess again.");
- entry = keyboard.nextInt();
- }
- System.out.println("\nThat's right! You're a good guesser!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement