Advertisement
Guest User

prog

a guest
Apr 4th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Simple_code
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             while (true)
  10.             {
  11.                 Console.WriteLine("Введите число: ");
  12.                 int num = int.Parse(Console.ReadLine());
  13.  
  14.                 if (num % 100 >= 11 && num % 100 <= 14)
  15.                 {
  16.                     Console.WriteLine($"{num} программистов");
  17.                 }
  18.                 else if (num % 10 >= 2 && num % 10 <= 4)
  19.                 {
  20.                     Console.WriteLine($"{num} программистa");
  21.                 }
  22.                 else if (num % 10 == 1 || num == 1)
  23.                 {
  24.                     Console.WriteLine($"{num} программист");
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine($"{num} программистов");
  29.                 }
  30.                
  31.             }
  32.  
  33.             Console.ReadLine();
  34.         }
  35.  
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement