I am trying to debug the following program with GDB. The program takes character inputs as you can see, but once I am in GDB shell, the inputs are interpreted by GDB. How do I address this please?

Here is the program:

Code:
#include <stdio.h>
int main ()
{
char ch;
printf ("\nPress any key to continue");
getch();
printf ("\nType any character");
ch = getche();
printf("\nType any character");
getchar();
printf("\nContinue Y/N");
fgetchar();
}

The problem I have is fgetchar() does not seem to do anything or at least what I want it to do, which is to echo the character that I type in. After I put in 3 characters, the program stops. I realize these are old dos functions, and I am using MinGw on Windows 10. So the program executes. I tried to run gdb, but I am not sure what I can do to see how the function call behaves.

Here you'll see that I had some problem with knowing exactly where gdb was in program execution, so I typed in some strange commands but I learned my way around it:

Code:
[New Thread 8112.0x18dc]
[New Thread 8112.0x19d0]
Breakpoint 1, main () at second.c:5
5       printf ("\nPress any key to continue");
(gdb) n
Press any key to continue6      getch();
(gdb) f
#0  main () at second.c:6
6       getch();
(gdb) n
8       printf ("\nType any character");
(gdb) d
Delete all breakpoints? (y or n) n
(gdb) n
Type any character9     ch = getche();
(gdb) w
Ambiguous command "w": watch, whatis, where, while, while-stepping, ws.
(gdb) n
w11     printf("\nType any character");
(gdb) n
Type any character12    getchar();
(gdb) n
r
13      printf("\nContinue Y/N");
(gdb) n
Continue Y/N14  fgetchar();
(gdb) n
15      }
(gdb)
0x00401250 in __mingw_CRTStartup ()
(gdb) n
Single stepping until exit from function __mingw_CRTStartup,
which has no line number information.
[Inferior 1 (process 8112) exited with code 012]
(gdb) n
The program is not being run.
(gdb) quit