answersLogoWhite

0

/*Hello!! I'm aditya From Bangalore I have the solution of this program*/

#include <stdio.h>

#include <math.h>

main()

{

float a,b,c,x1,x2,delta=0;

printf("enter the value of a,b,c\n");

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

delta=((b*b)-(4ac));

if(a=0)

{

printf("the variables cannot form a quadratic equation\n");

}

else

{

x1=(-b)+(sqrt(((b*b)-(4ac))/2a))

x2=(-b)-(sqrt(((b*b)-(4ac))/2a))

}

if(delta=0)

{

printf("the roots are real and equal");

}

if(delta>0)

{

printf("the roots are real and distinct");

}

if(delta<0)

{

printf("the roots are imaginary");

x1=(-b)+(sqrt(((b*b)-((4ac))/(float)(2a))

x2=(-b)-(sqrt(((b*b)-((4ac))/(float)(2a))

}

printf("the roots of the equation are %2.2f\n",x1,x2,delta);

}

/*the program is written by using simple-if and if-else constructs*/

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

Write a Qbasic program to find the root of a quadratic equation using the formula if the result is less than 0 the program should print the root are immerginary and end the program?

(Uses Square Root Function) PRINT "Ax^2 + Bx + C = 0" INPUT "A = ", A INPUT "B = ", B INPUT "C = ", C D = B * B - 4 * A * C IF D &gt; 0 THEN DS = SQR(D) PRINT "REAL ROOTS:", (-B - D) / (2 * A), (-B + D) / (2 * A) ELSE IF D = 0 THEN PRINT "DUPLICATE ROOT:", (-B) / (2 * A) ELSE DS = SQR(-D) PRINT "COMPLEX CONJUGATE ROOTS:", (-B / (2 * A)); "+/-"; DS / (2 * A); "i" END IF END IF


Draw an algorithm amd flowchat to claculate the roots of quadratic equation Ax2 Bx C0?

READ values of a, b and c,if a is zero then stop as we do not have a quadratic,calculate value of discriminantif D is zero then there is one root: ,if D is > 0 then there are two real roots: and ,if D is < 0 there are two complex roots: and ,PRINT solution.


C program to calculate the roots of a quadratic equation using two pointer parameters?

#include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;math.h&gt; void main() { float a, b, c; float root1, root2,de,d; printf("enter the values of a, b and c"); scanf("%f%f%f", &amp;a,&amp;b,&amp;c); de=(b*b)-4*(a*c); d=sqrt(de); root1=(-b+d) /(2.0*a); root2=(-b-d) /(2.0*a); printf(" roots of the equation are %f %f", root1,root2); getch(); }


Write a program to solve a quadratic equation using the quadratic formula in c plus plus?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { float a,b,c,z,d,x,y; clrscr(); printf("Enter the value of a,b,c"); scanf("%f %f %f",&amp;a,&amp;b,&amp;c); d=((b*b)-(4*a*c)); z=sqrt(d); x=(-b+z)/(2*a); y=(-b+z)/(2*a); printf("The Quadratic equation is x=%f and y=%f",x,y); getch(); } This answer does not think about imaginary roots. I am a beginner in C programming. There might be flaws in my code. But, it does well. the code is #include&lt;stdio.h&gt; #include&lt;math.h&gt; main() { float a, b, c; float dis, sqdis, real, imag, root1, root2; printf("This program calculates two roots of quadratic equation of the form ax2+bx+c=0.\n"); printf("\n"); printf(" please type the coefficients a, b and c\n"); printf("\n"); printf("a = "); scanf("%f", &amp;a); printf("\n"); printf("b = "); scanf("%f", &amp;b); printf("\n"); printf("c = "); scanf("%f", &amp;c); printf("\n"); dis = (b*b-4*a*c); if(dis &lt; 0) { sqdis = sqrt(-dis); real = -b/(2*a); imag = sqdis/(2*a); printf(" The roots of the quadratic equations are \n x1\t=\t %f + %f i\n x2\t=\t %f - %f i\n", real, imag, real, imag); } else { sqdis = sqrt(dis); root1 = -b/(2*a)+sqdis/(2*a); root2 = -b/(2*a)-sqdis/(2*a); printf("The two roots of the quadratic equations are %f and %f.\n", root1, root2); } system("pause"); }


If a light bulb is wired in series with a 133-ohm resistor and they are connected across a 131-volt source and the power delivered to the bulb is 22.9 watts then what are the two possible resistances?

First, we assume you are asking for the resistance of the bulb. Second, there can be only one possible resistance. The bulb has one and only one resistance. The equation for solving this problem may be a quadratic or even a cubic equation, which may have multiple roots, but only ONE can be a real-world answer. Third, let's list everything we know about the circuit. Let's label the power source Vcc. We'll label the known resistor R, and the resistance of the bulb Rb. We'll label the power dissipated by the bulb as simply P. We'll also label the current flowing through the bulb as I. What do we know about power? The power dissipated by a resistor is given by three well-known formulas: P = IV, P = I2R, or P = V2/R. (The second and third are derived from the first.) The second one will come in handy for us right now. We can write: [Equ. 1] P = I2Rb What else do we know? Since it's a series circuit, the current flowing through the bulb, I, is the same as the current flowing through the resistor. And we know from Ohm's Law that I = V/RT, where RT is the sum of the two resistances in the circuit: R + Rb. So, we can write: [Equ. 2] I = Vcc/(R + Rb) So, substituting for I in Equ. 1 with the I we found in Equ. 2 we have: P = [Vcc/(R + Rb)]2Rb = [Vcc2/(R + Rb)2]Rb = Vcc2Rb/(R2 + 2RRb + R2b) Phew! The algebra's getting a bit hairy. We need to do a few more manipulations. We can swap the P on the left side of the equal sign with the denominator of the fraction on the right side of the equal sign, so we write: R2 + 2RRb + R2b = Vcc2Rb/P We now multiply both sides of the equation by P and we write: PR2 + 2PRRb + PR2b = Vcc2Rb Stay with me now; we're almost there. If we subtract Vcc2Rb from both sides and gather similar terms, we can write: PR2b+ (2PR - Vcc2)Rb + PR2 = 0 We can now substitute all the known values into the equation above. We know Vcc = 131, R = 133, and P = 22.9. So, we can write: 22.9R2b - 11070Rb + 405078 = 0 So, we have quadratic equation, which will have two roots for Rb. Using the quadratic formula, we determine that there are two real roots: Rb = 443.5 and 39.9. The second result is thrown out since it is not consistent with Equ. 1 and Equ. 2.

Related Questions

Write an algorithm to find the root of quadratic equation?

Write an algorithm to find the root of quadratic equation


How do you write a poem on the roots of the quadratic equation?

2000X=Y2KoverZzz?


When the roots are equal of a quadratic equation?

Write the quadratic equation in the form ax2 + bx + c = 0 The roots are equal if and only if b2 - 4ac = 0. The expression, b2-4ac is called the [quadratic] discriminant.


Write an algorithm and draw a flowchart that will calculate the roots of quadratic equation?

dejene


What are the roots of the quadratic equation below?

That depends on the equation.


What are quadratic equations with real roots?

If the discriminant of the quadratic equation is zero then it will have 2 equal roots. If the discriminant of the quadratic equation is greater than zero then it will have 2 different roots. If the discriminant of the quadratic equation is less than zero then it will have no roots.


Algorithm to find the roots of a quadratic equation?

The easiest way to write a generic algorithm is to simply use the quadratic formula. If it is a computer program, ask the user for the coefficients a, b, and c of the generic equation ax2 + bx + c = 0, then just replace them in the quadratic formula.


Why do you use square roots to solve quadratic equations?

Because it's part of the quadratic equation formula in finding the roots of a quadratic equation.


How would you go about solving a quadratic equation?

Write the quadratic equation in the form ax2 + bx + c = 0 then the roots (solutions) of the equation are: [-b &plusmn; &radic;(b2 - 4*a*c)]/(2*a)


Can the answer to a quadratic equation be a decimal?

Yes. You can calculate the two roots of a quadratic equation by using the quadratic formula, and because there are square roots on the quadratic formula, and if the radicand is not a perfect square, so the answer to that equation has decimal.


Write a program in C programming language that computes the roots of the quadratic equation ax2 plus bx plus c?

Write your program and if you are having a problem post it here with a description of the problem you are having. What you are asking is for someone to do your homework for you.


How many roots does a quadratic equation?

2 roots