Advertisement
jkonova

Untitled

Aug 2nd, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2.  
  3. namespace OldBooks
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string favoriteBook = Console.ReadLine();
  10. string currentBook = Console.ReadLine();
  11.  
  12. int bookCount = 0;
  13.  
  14. while (currentBook != favoriteBook)
  15. {
  16. if (currentBook == "No More Books")
  17. {
  18. Console.WriteLine($"The book you search is not here!\nYou checked {bookCount} books.");
  19. }
  20.  
  21. bookCount++;
  22. currentBook = Console.ReadLine();
  23. }
  24. Console.WriteLine($"You checked {bookCount} books and found it.");
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement