Advertisement
IordanRujinov

FruitOrVegetable-IFconstruction

Nov 4th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace FruitOrVegetable
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //Да се прочете от конзолата дали е плод или зеленчук въведената дума,
  14.             //ако се въведе невалидна дума, да се изведе “unknown”.
  15.             string WhatIsThat = Console.ReadLine().ToLower();
  16.  
  17.             if (WhatIsThat == "banana" || WhatIsThat == "cherry"
  18.                 || WhatIsThat == "kiwi" || WhatIsThat == "lemon"
  19.                 || WhatIsThat == "grapes" || WhatIsThat == "apple")
  20.             {
  21.                 Console.WriteLine("fruit");
  22.             }
  23.             else if (WhatIsThat == "tomato" || WhatIsThat == "cucumber"
  24.                 || WhatIsThat == "carrot" || WhatIsThat == "pepper" )
  25.             {
  26.                 Console.WriteLine("vegetable");
  27.             }
  28.             else
  29.             {
  30.                 Console.WriteLine("unknown");
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement