@k0der
replace scanf("%c", &ch) with this:
scanf("%*[ \n\t]%c",&ch);

this will skip blanks, newlines n tabs.
in scanf above after '[' there is space
define ch as char.
cheers