Anonymous user
Roots of a quadratic function: Difference between revisions
m
→{{header|IS-BASIC}}
Line 848:
=={{header|IS-BASIC}}==
<lang IS-BASIC>
100 PROGRAM "Quadratic.bas"
110 PRINT "Enter coefficients a, b and c:":INPUT PROMPT "a= ,b= ,c= ":A,B,C
120 LET D=B^2-4*A*C▼
120 IF A=0 THEN
130 SELECT CASE SGN(D)▼
130 PRINT "The coefficient of x^2 can not be 0."
140
160 CASE 1▼
170 PRINT "The real roots are ";(-B+SQR(D))/(2*A);"and ";(-B-SQR(D))/(2*A)▼
200 END SELECT</lang>▼
210 CASE -1
220 PRINT "The complex roots are ";-B/2/A;"+/- ";STR$(SQR(-D)/2/A);"*i"
230 END SELECT
=={{header|J}}==
|