Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- namespace Библиотека___2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string needBooks = Console.ReadLine();
- int availableBoks = int.Parse(Console.ReadLine());
- int checkedBooks = 0;
- while (availableBoks > 0)
- {
- string giveBooks = Console.ReadLine();
- if (needBooks == giveBooks)
- {
- Console.WriteLine($"You checked {checkedBooks} books and found it.");
- break;
- }
- else
- {
- checkedBooks++;
- }
- availableBoks--;
- }
- if (availableBoks <= 0)
- {
- Console.WriteLine("The book you search is not here.");
- Console.WriteLine($"You checked {checkedBooks} books.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment