Advertisement
AleksandarGG

Fruits&Vegetables

Jun 12th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 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 Fruit_or_Vegetable
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             string nameProduct = Console.ReadLine();
  15.  
  16.             bool  fruit = true;
  17.             bool vegetable = true;
  18.  
  19.  
  20.  
  21.  
  22.  
  23.             if (nameProduct == fruit || nameProduct == vegetable)
  24.             {
  25.                 if (fruit == "banana")
  26.                 {
  27.                     Console.WriteLine("fruit");
  28.                 }
  29.                 else if (fruit == "apple")
  30.                 {
  31.                     Console.WriteLine("fruit");
  32.                 }
  33.                 else if (fruit == "kiwi")
  34.                 {
  35.                     Console.WriteLine("fruit");
  36.                 }
  37.                 else if (fruit == "cherry")
  38.                 {
  39.                     Console.WriteLine("fruit");
  40.                 }
  41.                 else if (fruit == "lemon")
  42.                 {
  43.                     Console.WriteLine("fruit");
  44.                 }
  45.                 else if (fruit == "grape")
  46.                 {
  47.                     Console.WriteLine("fruit");
  48.                 }
  49.                 else if (vegetable == "tomato")
  50.                 {
  51.                     Console.WriteLine("vegetable");
  52.                 }
  53.                 else if (vegetable == "cucumber")
  54.                 {
  55.                     Console.WriteLine("vegetable");
  56.                 }
  57.                 else if (vegetable == "pepper")
  58.                 {
  59.                     Console.WriteLine("vegetable");
  60.                 }
  61.                 else if (vegetable == "carrot")
  62.                 {
  63.                     Console.WriteLine("vegetable");
  64.                 }
  65.             }
  66.             else
  67.             {
  68.                 {
  69.                     Console.WriteLine("unknown");
  70.                 }
  71.  
  72.  
  73.             }
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement