QBASIC PROGRAM TO FIND SOLUTIONS OF QUADRATIC EQUATION

QBASIC PROGRAM TO FIND SOLUTIONS OF QUADRATIC EQUATION


X²+5X+6 INPUT : A=1 , B=5 , C=6 OUTPUT : -2,-3


 CLS
 INPUT "ENTER VALUE FOR A( coff. of x²"; A
 INPUT "ENTER VALUE FOR B( coff. of x)"; B
 INPUT "ENTER VALUE FOR C( constant)"; C
 D = (B * B - 4 * A * C) ^ (1 / 2)
 X = (-B + D) / 2 * A
 Y = (-B - D) / 2 * A
 PRINT "SOLUTION OF QUADRATIC EQUATION ARE"; X; Y
 END

USING SUB


DECLARE SUB QUADRATIC(A,B,C)
 CLS
 INPUT "ENTER VALUE FOR A( coff. of x²"; A
 INPUT "ENTER VALUE FOR B( coff. of x)"; B
 INPUT "ENTER VALUE FOR C( constant)"; C
 CALL QUADRATIC(A,B,C)
 END
 
 SUB QUADRATIC(A,B,C)
 D = (B * B - 4 * A * C) ^ (1 / 2)
 X = (-B + D) / 2 * A
 Y = (-B - D) / 2 * A
 PRINT "SOLUTION OF QUADRATIC EQUATION ARE"; X; Y
 END SUB

Post a Comment

0 Comments