Saturday, 6 June 2020

Write a sub-procedure to find the solution of quadratic equation ax2 +bx +c=0. The program should ask the value of a, b, and c from user in main module and pass them as parameter list when a sub program is called.

Answer: 
DECLARE SUB value(a, b, c)
CLS
           PRINT "Calculate ax^2+bx+c=0"
           INPUT "Enter a value of a"; a
           INPUT "Enter a value of b"; b
           INPUT "Enter a value of c"; c
CALL value(a, b, c)
END
SUB Triangle
           LET d=(b*b-4*a*c)^1/2
           LET x = (-b+d)/2*a
           LET y = (-b-d)/2*a
           PRINT "Result of quadratic equation are x, y"; x, y
END SUB

No comments:

Post a Comment

MCQ Question Bank Microsoft PowerPoint