I have the following program:
int main(int argc, char *argv[]) { char ch1, ch2; printf(\"Input the first character:\"); // Line 1 scanf(\"%c\", &ch
you can try
scanf("%c%*c", &ch1);
where %*c accepts and ignores the newline
one more method instead of fflush(stdin) which invokes undefined behaviour you can write
while((getchar())!='\n');
don't forget the semicolon after while loop