This program works (as you know already). However, it is somewhat of a taboo to refer to global variables in a subroutine (be it a function or a procedure). As a result, procedure find_factor_f_in_n is not as ideal as it could have been.
Your assignment is to fix this problem. You are to turn find_factor_f_in_n into a function that returns the factor. As a function, it should also take one (and only one) parameter.
You also need to change the main program so it calls a function instead of a procedure. In addition, you need to do something about the value returned by the function.
This is a summary of what you need to do (as a suggestion):
find_factor_f_of_n from a procedure to a function
These are the absolute requirements of your program:
find_factor_f_of_n to find
a prime factor of n
find_factor_f_of_n must be a function
find_factor_f_of_n must use one
parameter passed by value
find_factor_f_of_n must not access
any global variable directly
Submit the assignment to tauyeung@drtak.org with a subject line of ``CIS31 Project4 by My Name''.