Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01._Old_Books
- {
- class Program
- {
- static void Main(string[] args)
- {
- string bookName = Console.ReadLine();
- int bookCount = int.Parse(Console.ReadLine());
- string currentBookName = Console.ReadLine();
- int counter = 0;
- while (bookName != currentBookName)
- {
- counter++;
- if (counter == bookCount)
- {
- break;
- }
- currentBookName = Console.ReadLine();
- }
- if (bookName == currentBookName)
- {
- 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