Advertisement
Dianov

Conditional Statements Advanced - Lab (09. Fruit or Vegetable)

Nov 1st, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 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.         public static void Main()
  12.         {
  13.             string food = Console.ReadLine();
  14.  
  15.             if (food == "banana")
  16.             {
  17.                 Console.WriteLine("fruit");
  18.             }
  19.             else if (food == "apple")
  20.             {
  21.                 Console.WriteLine("fruit");
  22.             }
  23.             else if (food == "kiwi")
  24.             {
  25.                 Console.WriteLine("fruit");
  26.             }
  27.             else if (food == "cherry")
  28.             {
  29.                 Console.WriteLine("fruit");
  30.             }
  31.             else if (food == "lemon")
  32.             {
  33.                 Console.WriteLine("fruit");
  34.             }
  35.             else if (food == "grapes")
  36.             {
  37.                 Console.WriteLine("fruit");
  38.             }
  39.             else if (food == "tomato")
  40.             {
  41.                 Console.WriteLine("vegetable");
  42.             }
  43.             else if (food == "cucumber")
  44.             {
  45.                 Console.WriteLine("vegetable");
  46.             }
  47.             else if (food == "pepper")
  48.             {
  49.                 Console.WriteLine("vegetable");
  50.             }
  51.             else if (food == "carrot")
  52.             {
  53.                 Console.WriteLine("vegetable");
  54.             }
  55.             else
  56.             {
  57.                 Console.WriteLine("unknown");
  58.             }
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement