1
What error in my code? Because regardless of the answer, the result is the else
.
#include <stdio.h>
int
main ()
{ //variaveis
char sigla[3];
//programa
printf ("Entre com a sigla do seu estado:");
scanf ("%s", &sigla);
if ((sigla == "RJ") || (sigla == "rj"))
{
printf ("\nCarioca!");
}
else if ((sigla == "SP") || (sigla == "sp"))
{
printf ("\nPaulista");
}
else if ((sigla == "MG") || (sigla == "mg"))
{
printf ("\nMineiro!");
}
else
{
printf ("\nOutros Estados!");
}
return 0;
}
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero