Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include int main() { float a, b, c, x, x1, x2, i; printf(-------------------------Quadratic Equation Solver------------------------------); printf( Please enter the value of a: );

#include #include #include int main() {

float a, b, c, x, x1, x2, i; printf("-------------------------Quadratic Equation Solver------------------------------"); printf(" Please enter the value of a: "); scanf("%f", &a); printf(" Please enter the value of b: "); scanf("%f", &b); printf(" Please enter the value of c: "); scanf("%f",&c); x1 = (-b/2*a)+i*sqrt(4*a*c-b*b)/2*a; x2 = (-b/2*a)-i*sqrt(4*a*c-b*b)/2*a; x = (-b/2*a); if(b*b-4*a*c<0) { printf(" ---------------------------Complex Roots----------------------------------------"); printf(" x1:%.2f", x1); printf(" x2:%.2f", x2); printf(" -----------------------------------------------------------------------------"); } if(b*b-4*a*c==0) { printf(" ---------------------------Repeated Root-----------------------------------------------"); printf(" x:%.2f", x); printf(" ---------------------------------------------------------------------------------------"); } if(b*b-4*a*c>0) { printf(" ----------------------------Distinct Real Roots------------------------------------"); } return (0);

}

need the code to display the i for the complex roots, and need an equation for distinct real roots. thank you !

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions