write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0

Answer Posted / theara

#include<stdio.h>
#include<conio.h>
void main()
{
float a, b, c;
float x1, x2, root, d;
printf("Enter the values of a, b & c");
scanf("%d %d %d", &a, &b, &c);
if(a==0 && b==0)
printf("There izz no Soln...");
else
if(a=0)
{
root= -c/b;
printf("root = %d", root);
}
else
d = b*b-4*a*c;
if(d>=0)
{
x1 = (-b + d)/2*a;
x2 = (-b - d)/2*a;
printf("Roots are....x1 = %f, x2 = %f\n", x1,x2);
}
else
printf("Given Eqn has imaginary roots");
getch();
}

Is This Answer Correct ?    14 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Add Two Numbers Without Using the Addition Operator

348


What is use of #include in c?

586


Write a program to reverse a given number in c?

585


Explain how can you restore a redirected standard stream?

583


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1444






Explain why C language is procedural?

763


Explain the difference between ++u and u++?

631


Explain what happens if you free a pointer twice?

602


Multiply an Integer Number by 2 Without Using Multiplication Operator

310


What is data structure in c language?

595


Explain what are its uses in c programming?

586


Is register a keyword in c?

623


What is c variable?

541


Write a progarm to find the length of string using switch case?

1597


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

613