Advertisement
desislava_topuzakova

03. Animal Type

Jun 18th, 2022
827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03._Animal_Type
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.            string animal = Console.ReadLine();
  10.             //dog -> mammal
  11.             //crocodile, tortoise, snake -> reptile
  12.             //other -> unknown
  13.  
  14.             //switch -> серия от проверки за точни стойности за променлива animal
  15.             switch (animal)
  16.             {
  17.                 case "dog":
  18.                     Console.WriteLine("mammal");
  19.                     break;
  20.                 case "crocodile":
  21.                 case "tortoise":
  22.                 case "snake":
  23.                     Console.WriteLine("reptile");
  24.                     break;
  25.                 default:
  26.                     Console.WriteLine("unknown");
  27.                     break;
  28.             }
  29.         }
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement