desislava_topuzakova

4. Плод или зеленчук

Nov 20th, 2021
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Fruit_or_Vegetable
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string product = Console.ReadLine();
  10.             //banana, apple, kiwi, cherry, lemon и grapes -> print fruit
  11.             //tomato, cucumber, pepper и carrot -> print vegetable
  12.             //other -> print unknown
  13.  
  14.             if (product == "banana" || product == "apple" || product == "kiwi" || product == "cherry"
  15.                 || product == "lemon" || product == "grapes")
  16.             {
  17.                 Console.WriteLine("fruit");
  18.             }
  19.             else if (product == "tomato" || product == "cucumber" || product == "pepper" || product == "carrot")
  20.             {
  21.                 Console.WriteLine("vegetable");
  22.             }
  23.             else
  24.             {
  25.                 Console.WriteLine("unknown");
  26.             }
  27.         }
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment