Last active
April 22, 2017 16:43
-
-
Save ochui/600b56f4a6505492949264db4dda8b01 to your computer and use it in GitHub Desktop.
******QBAIC PROGRAM TO CALCULATE THE ROOT OF QUADRATIC EQUATION*********
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM *******QBAIC PROGRAM TO CALCULATE THE ROOT OF QUADRATIC EQUATION********* | |
REM *******http://niarageeks.com.ng************************************** | |
CLS | |
DIM v(3) AS INTEGER | |
DIM x(2) AS DOUBLE | |
DIM s AS INTEGER | |
DIM d AS INTEGER | |
DO | |
CLS | |
PRINT "VALUE OF A MUST BE GREATER THAN ZERO" | |
INPUT "ENTER VALUE FOR A";v(0) | |
INPUT "ENTER VALUE FOR B";v(1) | |
INPUT "ENTER VALUE FOR C";v(2) | |
LOOP WHILE v(0) = 0 | |
A = v(0) | |
B = v(1) | |
C = v(2) | |
s = B ^ 2 - 4 * A * C | |
d = 2 * A | |
IF s > 0 THEN | |
x(0) = (-B + SQR(s)) / d | |
PRINT "X1 = ";x(0) | |
x(1) = (-B - SQR(s)) / d | |
PRINT "X2 =";x(1) | |
ELSE | |
IF s = 0 THEN | |
PRINT "the equation has only one real root" | |
x(1) = -B / d | |
PRINT "X1 = ";X(1) | |
ELSE | |
PRINT "the eqaution has no root" | |
END IF | |
END IF | |
END | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment