Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone tell me what's going on with my C programming code? I Can't run it. Here the Question for this code in C: Using

Can someone tell me what's going on with my C programming code? I Can't run it.
Here the Question for this code in C:
Using whatever method you like in whichever language you like (C or Matlab), write a script
that includes a function (not main) which solves for the roots of the quadratic equation:
= (b b2 4ac ) / 2a
where a, b, and c are accepted as inputs. The roots should be presented in complex form.
image text in transcribed
Chuck) My Mae Chuck Build Chuck Palled Today 934 PM main. Chuck ) Chuck) maline) No Selection int main() 5 6 float a, b, c, Discriminant, roots, foot2, tealPart, nagpart: SA de Deine 2 printf("Enter coefficient a, b, and c: ) scanf("%f NT". Sa, sb, ); complex_number(a,b,c); 10 return : 11 12) 13 16 int complex_number(int , int b, inte); 15 ( 16 float discriminant, rooti, roota, realPart, nagPart; 17 discriminant b.b-4.a. 18 19 // condition for real and different roots if (discriminant > 0) 21 { 22 printf(" The roots are real and different "); 23 root1 = (b + sert(discriminant)) / ( 2a); 24 root2 - (- - sqrt(discriminant)) / (2.a); 25 printf("Rooti = N.2f and Root2 - %.2f", roots, root2) 26 27 28 // condition for real and different roots 29 if (discriminant > e) 30 31 printf(" The roots are real and equal "); 32 rooti - root2 = -b/(2a); 33 printf("Root = Root2 - %.2f;", root) 34 > 35 36 // condition for imaginary roots 37 else { printf("In The roots are not real "); realPart = -b/( 2a) imagPart sort(-discriminant) / (2.0); 41 printf("Rooti = X.248.214 and Root2 = %.21-4.21-4.2.11", real Part, Imagport, realPart, Imagpart); 42 > return; 45 MacBook Air

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

Recommended Textbook for

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions