Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Old_Books
- {
- class Program
- {
- static void Main(string[] args)
- {
- string favBook = Console.ReadLine();
- int counter = 0;
- string nextBook = Console.ReadLine();
- while (nextBook != "No More Books")
- {
- if (nextBook==favBook)
- {
- Console.WriteLine($"You checked {counter} books and found it.");
- break;
- }
- counter++;
- nextBook = Console.ReadLine();
- }
- if (nextBook=="No More Books")
- {
- 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