URI - BEECROWD - BEE 1050 - DDD Solution in C,C++,Python | URI - BEECROWD - BEE Online Judge Solution 1050 - DDD
Read an integer number that is the code number for phone dialing. Then, print the destination according to the following table:
If the input number isn’t found in the above table, the output must be:
DDD nao cadastrado
That means “DDD not found” in Portuguese language.
Input
The input consists in a unique integer number.
Output
Print the city name corresponding to the input DDD. Print DDD nao cadastrado if doesn't exist corresponding DDD to the typed number.
Input Sample | Output Sample |
11 | Sao Paulo |
URI Online Judge Solution 1050 - DDD | URI 1050 Solution in C,C++,Python :
Demonstration:
It's a not a hard problem.You just have to check the conditions by using if-else or switch statement to find the combination of the table given.Then you have to print those values according to the problem's statement.
#include <stdio.h>
int main()
{
int N;
scanf("%d",&N);
if(N==61)
printf("Brasilia\n");
else if(N==71)
printf("Salvador\n");
else if(N==11)
printf("Sao Paulo\n");
else if(N==21)
printf("Rio de Janeiro\n");
else if(N==32)
printf("Juiz de Fora\n");
else if(N==19)
printf("Campinas\n");
else if(N==27)
printf("Vitoria\n");
else if(N==31)
printf("Bela Horizonte\n");
else
printf("DDD nao cadastrado\n");
return 0;
}
0 Response to URI - BEECROWD - BEE 1050 - DDD Solution in C,C++,Python | URI - BEECROWD - BEE Solution 1050 - DDD
Post a Comment