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 scanner = new Scanner(System.in);
- String correctBook = scanner.nextLine();
- String inputBook = scanner.nextLine();
- int attempts = 1;
- while (!inputBook.equals(correctBook)) {
- attempts += 1;
- inputBook = scanner.nextLine();
- }
- System.out.printf("Book found! Attempts: %d", attempts);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement