Anzzhhela98

Untitled

Jul 16th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3.  
  4. namespace Библиотека___2
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string needBooks = Console.ReadLine();
  11.  
  12.             string giveBooks = Console.ReadLine();
  13.             bool isBooktrue = false;
  14.             int checkedBooks = 0;
  15.             while (giveBooks != "No More Books")
  16.             {
  17.                 giveBooks = Console.ReadLine();
  18.                 checkedBooks++;
  19.  
  20.                 if (needBooks == giveBooks)
  21.                 {
  22.                     isBooktrue = true;
  23.                    
  24.                     break;
  25.                 }
  26.                  
  27.                    
  28.  
  29.             }
  30.             if (isBooktrue)
  31.             {
  32.                 Console.WriteLine($"You checked {checkedBooks} books and found it.");
  33.             }
  34.             else
  35.             {
  36.                 Console.WriteLine("The book you search is not here!");
  37.                 Console.WriteLine($"You checked {checkedBooks} books.");
  38.             }
  39.  
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment