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
What is an endless loop?
What is define directive?
#include
What is meant by keywords in c?
Write a program to reverse a string.
define string ?
what is different between auto and local static? why should we use local static?
What do you mean by recursion in c?
Dont ansi function prototypes render lint obsolete?
Which node is more powerful and can handle local information processing or graphics processing?
What is atoi and atof in c?
What is the best organizational structure?
Is it possible to have a function as a parameter in another function?
C program to find all possible outcomes of a dice?
Why structure is used in c?