[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.


The input consists in a unique integer number.


Print the city name corresponding to the input DDD. Print DDD nao cadastrado if doesn’t exist corresponding DDD to the typed number.

Sample Inputs Sample Outputs
11 Sao Paulo
33 DDD nao cadastrado


#include <cstdio>
int main(){
 int d;
 scanf("%d", &d);
 if (d == 61)
 else if (d == 71)
 else if (d == 11)
 printf("Sao Paulo\n");
 else if (d == 21)
 printf("Rio de Janeiro\n");
 else if (d == 32)
 printf("Juiz de Fora\n");
 else if (d == 19)
 else if (d == 27)
 else if (d == 31)
 printf("Belo Horizonte\n");
 printf("DDD nao cadastrado\n");

2 thoughts on “[URI Online Judge] – 1050 – DDD

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s