Next: About this document ...
Up: Conditionals
Previous: More about IF

Checkoff

Look at the partial program ``quad.f'' in your ``examples'' directory (or view it directly). Notice that we have changed the specification of the QUAD subroutine so that it can deal sensibly with quadratic equations for which there are two, one, or zero real roots.

Complete the implementation of QUAD so that it behaves according to its specification. You will probably find it helpful to borrow code from your solution to the checkoff assignment in the previous lesson.

Homework Problem 4

Write a program for which the user inputs 3 numbers a, b, and c, and after checking to insure that a > 0 and that , it branches to a function subroutine that computes both of the roots of the quadratic . Then have the program print out a, b, c, and the two roots. If either , or else if , then have your program print out an appropriate error message and then stop.

Call your program solution4.f. To submit it for grading, use the UNIX Shell window to connect to the directory that contains your program and enter the following command

handin cs101 problem-4 solution4.f


Next: About this document ...
Up: Conditionals
Previous: More about IF

Hamlet Project
hamlet@cs.utah.edu