Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need To write a program that solves the quadratic equation for any a b c chose

ID: 2993668 • Letter: I

Question

I need To write a program that solves the quadratic equation for any a b c chosed. I have a good shell, but the oputput is incorrect. Please help me resolve this! The code is as follows:
#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c;
float x,y,d;
printf("Enter a b c of quadratic equation separated by spaces ");
scanf("%d %d %d",&a,&b,&c);
d=(b*b)-(4*a*c);
if(d<0)
printf("Real number root is not possible. ");
else
x=(-b+sqrt(d))/(2*a);
y=(-b-sqrt(d))/(2*a);
printf("Solution of quadratic equation are %f %f ",x,y);
return 0;
}

Explanation / Answer

#include<stdio.h>

#include<math.h>

int main()

{

int a,b,c;

float x,y,d;

printf("Enter a b c of quadratic equation separated by spaces ");

scanf("%d %d %d",&a,&b,&c);

d=(b*b)-(4*a*c);

if(d<0)

printf("Real number root is not possible. ");

else

{

x=(-b+sqrt(d))/(2*a);

y=(-b-sqrt(d))/(2*a);

printf("Solution of quadratic equation are %f %f ",x,y);

}

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote