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 counter = 0;
- bool bookFound = false;
- string books = Console.ReadLine();
- while (books != "No More Books")
- {
- if (books == book)
- {
- bookFound = true;
- break;
- }
- counter++;
- books = Console.ReadLine();
- }
- if (bookFound == true)
- {
- 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.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment