Advertisement
dragonbs

Old Books

Oct 23rd, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01.OldBooks
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string kniga = Console.ReadLine();
  10.             int countT = 0;
  11.  
  12.             string segashnaKniga = Console.ReadLine();
  13.  
  14.             while (segashnaKniga != kniga)
  15.             {
  16.                 if (segashnaKniga == "No More Books")
  17.                 {
  18.                     Console.WriteLine("The book you search is not here!");
  19.                     Console.WriteLine($"You checked {countT} books.");
  20.                     break;
  21.                 }
  22.                 countT++;
  23.  
  24.                 segashnaKniga = Console.ReadLine();
  25.             }
  26.                 if (segashnaKniga == kniga)
  27.                 {
  28.                     Console.WriteLine($"You checked {countT} books and found it.");
  29.                 }
  30.             }
  31.         }
  32.     }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement