Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Monday, 14 November 2016

URI-1050

URI Online Judge | 1050

DDD

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
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 não 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 SampleOutput Sample
11Sao Paulo

Solution...

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

No comments:

Post a Comment