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
Should I learn data structures in c or python?
What is a protocol in c?
What are control structures? What are the different types?
How can you find out how much memory is available?
What are inbuilt functions in c?
write a program to find the given number is prime or not
What is selection sort in c?
Explain how do you declare an array that will hold more than 64kb of data?
regarding pointers concept
What is getch() function?
Give the rules for variable declaration?
What is the condition that is applied with ?: Operator?
What are the three constants used in c?
Do you know pointer in c?
How can you increase the size of a dynamically allocated array?