Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _03.OddEvenPosition
- {
- class Program
- {
- static void Main(string[] args)
- {
- string favoriteBook = Console.ReadLine();
- int bookCounter = 0;
- string currentBook = Console.ReadLine();
- while (currentBook != "No More Books")
- {
- if (currentBook == favoriteBook)
- {
- Console.WriteLine($"You checked {bookCounter} books and found it.");
- break;
- }
- bookCounter++;
- currentBook = Console.ReadLine();
- }
- if (currentBook == "No More Books")
- {
- Console.WriteLine("The book you search is not here!");
- Console.WriteLine($"You checked {bookCounter} books.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement