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