Convert from while to do loop.
Split into functions.
Solve Problem 2 in Fortran.