Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace OldBooks
- {
- class Program
- {
- static void Main()
- {
- string book = Console.ReadLine();
- int bookCount = int.Parse(Console.ReadLine());
- string command = Console.ReadLine();
- int counter = 0;
- for (int i = 0; i < bookCount && command != ""; i++)
- {
- if (command == "No More Books" || command == book)
- {
- break;
- }
- counter++;
- command = Console.ReadLine();
- }
- if (command == book)
- {
- Console.WriteLine($"You checked {counter} books and found it.");
- }
- else
- {
- Console.WriteLine("The book you search is not here!");
- Console.WriteLine($"You checked {counter} books.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement