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 |
What are static variables in c?
What is a pointer on a pointer in c programming language?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?
What is || operator and how does it function in a program?
What is multidimensional arrays
What does c mean before a date?
Program to find the absolute value of given integer using Conditional Operators
What is the condition that is applied with ?: Operator?
explain what is fifo?
related to rdbms query .
code snippet for creating a pyramids triangle ex 1 2 2 3 3 3