21st Sep 2023, 7:35 PM
Delord carmel
Delord carmel - avatar
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
21st Sep 2023, 7:45 PM
Ausgrindtube - avatar
+ 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
21st Sep 2023, 9:32 PM
Juan - avatar
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.
22nd Sep 2023, 4:18 AM
Juan - avatar