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
What is wild pointer in c?
What is the function of this pointer?
Why is structure important for a child?
What are the different categories of functions in c?
Does c have an equivalent to pascals with statement?
Simplify the program segment if X = B then C ← true else C ← false
I have a varargs function which accepts a float parameter?
Can a void pointer point to a function?
Can the “if” function be used in comparing strings?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
How can I direct output to the printer?
If the size of int data type is two bytes, what is the range of signed int data type?
What are loops in c?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
why programs in c are running with out #include