I found it myself :)
i should use abs(r) :) , thanks for giving me a chance to ask you :)
User Profile
Collapse
-
-
calculating the roots of ax**2+bx+c
hello :
This is my code :
------------------------------------------
Code:while True : try: ' enter the coefficients of the equation :' a=input('a=' ) b=input('b=' ) c=input('c=' ) r=b**2-4*a*c import cmath sq=cmath.sqrt if r==0 : x=(-b)/(2*a)
Last edited by bvdet; Nov 27 '12, 06:46 PM. Reason: Please use code tags when posting code [code].......[/code]
No activity results to display
Show More
Leave a comment: