CSC 117 Programming for Scientists and Engineers
Project 3 Due: Tuesday, July 23, 2002
Total points : 25
If a, b, and c are constants, the quadratic formula gives a
solution to the equation ax²+bx+c=0. That formula is:
x = (-b± sqrt(b²-4ac))/(2a)
The quantity b²-4ac is called the discriminant.
Write a program which prompts the user to enter the coeffients of
a quadratic equation and then computes and prints the real solutions.
Your program must deal with all cases, as follows:
-
If a \= 0 and the discriminant is positive, there are two solutions.
-
If a \= 0 and the discriminant is zero, there is one solution.
-
If a \= 0 and the discriminant is negative, there is no solution.
-
If a = 0 and b \= 0, there is one solution, namely -c/b.
-
If a = 0, b = 0, and c \= 0, there is no solution.
-
If a = 0, b = 0, and c = 0, then the equation is a tautology,
that is, every number is a solution.
Use nested IF
structures in the most efficient way you can.
Please email the program to the grader by midnight on the due date.
You can use the command:
mail liuq@egr.unlv.edu -s "Project 3" < proj3.f90
where ' proj3.f90 '
is the name of the file you want to send.