*shudders* scanf and gets.
the scanf is leaving a newline in the input buffer which is picked up by the gets before you enter anything.
Add this between the scanf and gets:
Code:
while( getchar() != '\n' );
This will clear the buffer.
As for the gets, don't ever use it. It will allow the user to overwrite memory, use fgets. fgets allows you to specify the maximum amount of input.
Code:
char name[10];
printf("Enter name");
fgets( name, sizeof( name ), stdin );
Now your user can't enter more characters than you provide storage for.
fgets also provides an alternative to scanf
Code:
char buffer[20];
int number;
printf("Enter number");
fgets( buffer, sizeof( buffer ), stdin );
sscanf( buffer, "%d", &number );
Now you don't need the while( getchar()!='\n);