next up previous
Next: About this document ...

ESC 251 HW 10 Due: Sep. 27

Remember to indent the bodies of your IF-THEN blocks.

(3 pts) An important application of IF-THEN statements is error checking. Error checking means that you take steps to ensure that a calculation won't fail before attempting to perform it. Examples of this include dividing by zero, taking the square root of a negative number, taking the log of a negative number, etc.

Write an F90 program that will ask the user to input 2 double precision values a and b. If it is feasible to do so, the program should compute the quotient $\displaystyle {\frac{a}{b}}$ and display the result. Otherwise, the program should print out an appropriate error message. Devise 2 test cases that will test each branch of your IF-THEN statement.

(3 pts) Write an F90 program that will read in an integer from the keyboard and print out a message telling the user whether the integer is either even or odd. This program is not difficult, but it does require some thinking. Looking over the list of intrinsic functions given in class might help.