URI Online Judge Solution 1049 - Animal | URI 1049 Solution in C,C++,Python

 URI Online Judge Solution 1049 - Animal | URI 1049 Solution in C,C++,Python

In this problem, your job is to read three Portuguese words. These words define an animal according to the table below, from left to right. After, print the chosen animal defined by these three words.

URI 1049 Animal Solution in C,C++,Python

Input

The input contains 3 words, one by line, that will be used to identify the animal, according to the above table, with all letters in lowercase.

Output

Print the animal name according to the given input.

Input SamplesOutput Samples

vertebrado
mamifero
onivoro

homem

vertebrado
ave
carnivoro

aguia

invertebrado
anelideo
onivoro

minhoca

URI Online Judge Solution 1049 - Animal | URI 1049 Solution in C,C++,Python :

                                        Demonstration:


It's a not a hard problem.You just have to check the conditions by using if-else statement to find the combination of the table given.Then you have to print those values according to the problem's statement.

N.B: Don't copy paste the code as same. Just try to understand it and try yourself. It would be better for you.


  URI Problem 1049 Solution in C :   

  URI Online Judge 1049 Solve  in C :                                                                             
#include <stdio.h>

int main()
{
    char a[15];
    char b[15];
    char c[15];
    scanf("%s", a);
    scanf("%s", b);
    scanf("%s", c);

    if (a[0] == 'v' && b[0] == 'a' && c[0] == 'c')printf("aguia\n");
    if (a[0] == 'v' && b[0] == 'a' && c[0] == 'o')printf("pomba\n");
    if (a[0] == 'v' && b[0] == 'm' && c[0] == 'o')printf("homem\n");
    if (a[0] == 'v' && b[0] == 'm' && c[0] == 'h')printf("vaca\n");
    if (a[0] == 'i' && b[0] == 'i' && c[2] == 'm')printf("pulga\n");
    if (a[0] == 'i' && b[0] == 'i' && c[2] == 'r')printf("lagarta\n");
    if (a[0] == 'i' && b[0] == 'a' && c[0] == 'h')printf("sanguessuga\n");
    if (a[0] == 'i' && b[0] == 'a' && c[0] == 'o')printf("minhoca\n");

    return 0;
}

0 Response to URI Online Judge Solution 1049 - Animal | URI 1049 Solution in C,C++,Python

Post a Comment