GCC, the GNU Compiler Collection is probably best for compiling small programs.

For Windows read this suggesting regularly updated mingw-w64 over outdated MinGW. Add bin subfolder to system PATH.

To compile a Fortran code run gfortran codefile -o binaryfile.

For debugging use GDB. Instructions: compile your code using -g option and then run gdb --args binaryfile arguments, start debugging with break main followed by run, then use s to go through your program step by step, use print variablename for variables and q to exit.

Help for Fortran see here.