Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/
#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;
}
i did this with switch case but it is shown 10% wrong do you know why?
ReplyDeleteSame with me. It showed 20% wrong answer but when I test my program, it gives correct output. I am confused.
Deletehttps://ideone.com/hu3hmO