0

# Please help me on this code

3 Answers

+ 4

Can you update the tags?
That can help people who know the language to come and help you. Read this for information:
https://code.sololearn.com/W3uiji9X28C1/?ref=app

+ 1

The code seems to require a few inputs from the user. For some reason, it isn't grabbing the second two inputs. It grabs a and that is it. The math looks almost right, root1=(-b+sqrt(discrim)/(2*a)) the parenthesis is off, this will only divide the sqrt by 2a.
root1=(-b+sqrt(discrim))/(2*a) is what you want. also the same for root2

0

I figured I was not inputting the inputs on separate lines which was an error on my part. The code does need those parenthesis changed. Also, on the imaginary case, C does not support negative numbers for the square root function, so I would multiply by -1 then find the square root. On your print statement you should add "i" string to show it's the imaginary part.