URI / BEE CROWD 1134 - Type of Fuel - Solution in C,C++,Python | URI - BEECROWD - BEE 1134 Solution in C,C++,Python

 URI / BEE CROWD 1134 - Type of Fuel - Solution in C,C++,Python | URI - BEECROWD - BEE 1134 Solution in C,C++,Python

                                                                                             beecrowd | 1134

Type of Fuel

Adapted by Neilor Tonin, URI  Brazil

                                                                                             Timelimit: 1


URI / BEE CROWD 1134 - Type of Fuel - Solution in C,C++,Python | URI - BEECROWD - BEE 1134 Solution in C,C++,Python :

A gas station wants to determine which of their products is the preference of their customers. Write a program to read the type of fuel supplied (coded as follows: 1. Alcohol 2. Gasoline 3. Diesel 4. End). If you enter an invalid code (outside the range of 1 to 4) a new code must be requested. The program will end when the inserted code is the number 4.

Input

The input contains only integer and positive values.

Output

It should be written the message: "MUITO OBRIGADO" and the amount of customers who fueled each fuel type, as an example.

Input SampleOutput Sample

8
1
7
2
2
4

MUITO OBRIGADO
Alcool: 1
Gasolina: 2
Diesel: 0

N.B: Don't copy paste the code as same. Just try to understand it and try yourself.

  URI / BEE 1134 Solution in C :   

  URI / BEECROWD Online Judge 1134 Solve  in C :                                          

#include <stdio.h>
int main()
{
    int a, x=0, y=0, z=0;
    while(1)
    {
        scanf("%d", &a);
        if(a==4)
            break;
        else
        {
            if(a==1) x++;
            else if(a==2) y++;
            else if(a==3) z++;
            else continue;
        }
    }
    printf("MUITO OBRIGADO\n");
    printf("Alcool: %d\n",x);
    printf("Gasolina: %d\n",y);
    printf("Diesel: %d\n",z);
    return 0;
}

0 Response to URI / BEE CROWD 1134 - Type of Fuel - Solution in C,C++,Python | URI - BEECROWD - BEE 1134 Solution in C,C++,Python

Post a Comment