Anny, Please correct the mistakes pointed out in the previous post by oogabooga. Along with that you need to flush the input stream before taking the next input...

Code: c
char ch;
while((ch = getchar()) != EOF && ch != '\n');

Regards,
Ahamed.