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
Add Two Numbers Without Using the Addition Operator
What is use of #include in c?
Write a program to reverse a given number in c?
Explain how can you restore a redirected standard stream?
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
Explain why C language is procedural?
Explain the difference between ++u and u++?
Explain what happens if you free a pointer twice?
Multiply an Integer Number by 2 Without Using Multiplication Operator
What is data structure in c language?
Explain what are its uses in c programming?
Is register a keyword in c?
What is c variable?
Write a progarm to find the length of string using switch case?
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