Example: Animal Type

Write a program that prints the type of the animal depending on its name:

  • dog -> mammal
  • crocodile, tortoise, snake -> reptile
  • others -> unknown

Sample Input and Output

Input Output Input Output Input Output
tortoise reptile dog mammal elephant unknown

Solution

We can solve the task with switch-case conditions with multiple labels in the following way:

Testing in the Judge System

Test your solution here: https://judge.softuni.bg/Contests/Practice/Index/508#9.

results matching ""

    No results matching ""