Roots of a quadratic function: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 846: | Line 846: | ||
-> |
-> |
||
</pre> |
</pre> |
||
=={{header|IS-BASIC}}== |
|||
<lang IS-BASIC>100 PROGRAM "Quadratic.bas" |
|||
110 INPUT PROMPT "a= ,b= ,c= ":A,B,C |
|||
140 LET D=B^2-4*A*C |
|||
150 SELECT CASE SGN(D) |
|||
160 CASE 0 |
|||
170 PRINT "The single root is ";-B/2/A |
|||
180 CASE 1 |
|||
190 LET F=(1+SQR(1-4*A*C/B^2))/2 |
|||
200 PRINT "The real roots are ";-F*B/A;"and ";-C/B/F |
|||
210 CASE -1 |
|||
220 PRINT "The complex roots are ";-B/2/A;"+/- ";STR$(SQR(-D)/2/A);"*i" |
|||
230 END SELECT</lang> |
|||
=={{header|J}}== |
=={{header|J}}== |