URI Online Judge | 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.
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 |
Solution:
#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;
}
Post a Comment
0Comments