Jump to content

Roots of a quadratic function: Difference between revisions

m
No edit summary
Line 850:
<lang IS-BASIC>100 PROGRAM "Quadratic.bas"
110 INPUT PROMPT "a= ,b= ,c= ":A,B,C
140120 LET D=B^2-4*A*C
150130 SELECT CASE SGN(D)
160140 CASE 0
170150 PRINT "The single root is ";-B/2/A
180160 CASE 1
190170 LETPRINT F="The real roots are ";(1-B+SQR(1-4D))/(2*A*C/);"and ";(-B^2-SQR(D))/(2*A)
210180 CASE -1
200190 PRINT "The realcomplex roots are ";-F*B/2/A;"and+/- ";STR$(SQR(-CD)/B2/FA);"*i"
210 CASE -1
230200 END SELECT</lang>
220 PRINT "The complex roots are ";-B/2/A;"+/- ";STR$(SQR(-D)/2/A);"*i"
230 END SELECT</lang>
 
=={{header|J}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.