Code is outputting the default in switch/case
it compiles but it always outputs the default
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include<stdio.h>
int main()
{
int a;
printf("Choose 11,22,33,44 ");
scanf("%d,&a");
fflush(stdin);
switch (a)
{
case 11: printf("YOU CHOSE 11"); break;
case 22: printf("YOU CHOSE 22"); break;
case 33||44: printf("\nYOU CHOSE 33 OR 44"); break;
default: printf("\nUNKNOWN"); break;
}
getchar();
return 0;
}
|
thank you! i feel so dumb
Hello WHYISNTITWORKING3275,
Line 14 should be:
1 2
|
case 33:
case 44: printf("\nYOU CHOSE 33 OR 44"); break;
|
the || does not work.
Hope that helps,
Andy
Topic archived. No new replies allowed.