I got the foilowing code:
Code:
#include <stdio.h>
main()
{
int x;
printf("Write a number: \n");
scanf("%d", &x);
switch (x);
{
case 1: { printf("A\n"); break; }
case 2: { printf("AA\n"); break; }
case 3: { printf("AAA\n"); break; }
default: { printf("Wrong Number\n"); break; }
}
}
i don't know what is the problem but when try compile i get this:
gcc -o switch switch.c
switch.c: In function `main':
switch.c:11: case label not within a switch statement
switch.c:12: case label not within a switch statement
switch.c:13: case label not within a switch statement
switch.c:14: `default' label not within a switch statement
switch.c:11: break statement not within loop or switch
switch.c:12: break statement not within loop or switch
switch.c:13: break statement not within loop or switch
switch.c:14: break statement not within loop or switch
any ideas?