Answer Posted / valli
/***********
quadratic equationis ax^2+bx+c=0
************8/
#include<math.h>
main()
{
int a,b,c,d,r1,r2;
printf("enter the values of a,b,c");
scanf("%d%d%d",&a,&b,&c)'
d=(b*b)-(4*a*c);
if(d<0)
{
printf("the roots are imaginary");
d=sqrt(-d);
printf("\nroots are %d+i%d",-b/(2*a),d/(2*a));
printf("\n%d-i%d",-b/(2*a),d/(2*a));
}
else
{
d=sqrt(d);
r1=(-b+d)/(2*a);
r2=(-b-d)/(2*a);
printf("the roots of the equation are %d %d ",r1,r2);
}
}
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?
Tell me with an example the self-referential structure?
What are operators in c?
What is use of #include in c?
What do you mean by recursion in c?
What is wrong with this declaration?
Explain what header files do I need in order to define the standard library functions I use?
How do you override a defined macro?
What is the difference between int main and void main?
How can you increase the allowable number of simultaneously open files?
What are global variables?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
What is the purpose of sprintf() function?
Why do we use & in c?
Why is c still so popular?