program to find the roots of a quardratic equation
Answer / 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 |
Why do we need a structure?
what is the difference between i++ and ++i?
Write a program for deleting duplicate elements in an array
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
what is the difference between postfix and prefix unary increment operators?
What is the Difference between Class and Struct?
Q. where is the below variables stored ? - volatile, static, register
Is this program statement valid? INT = 10.50;
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Why preprocessor should come before source code?
Who had beaten up hooligan "CHAKULI" in his early college days?
what is the difference between declaration ,defenetion and initialization of a variable?