Wednesday, December 2, 2015

Uri problem 1050 solve

Problem :

DDD

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
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.
Sample InputsSample Outputs
11Sao Paulo
33DDD nao cadastrado

Solution:

#include <stdio.h>
  
int main() {
   int A;
    scanf("%d",&A);
    if(A == 61)
    {
        printf("Brasilia\n");
    }
    else if(A == 71)
    {
        printf("Salvador\n");
    }
    else if(A== 11)
    {
        printf("Sao Paulo\n");
    }
    else if(A== 21)
    {
        printf("Rio de Janeiro\n");
    }
    else if(A== 32)
    {
        printf("Juiz de Fora\n");
    }
    else if (A==19)
    {
        printf("Campinas\n");
    }
    else if(A==27)
    {
        printf("Vitoria\n");
    }
    else if(A==31)
    {
        printf("Belo Horizonte\n");
    }
    else
    {
        printf("DDD nao cadastrado\n");
    }
 
 
  
    return 0;
}

No comments:

Post a Comment