write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / abc
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,root;
float x1,x2;
printf("enter the roots a,b,c");
scanf("%d %d %d",&a,&b,&c);
if(a=0&&b=0)
printf("no solution");
else
if(a=0)
{
root=-c/b;
printf("root=%d",root);
}
else
if[(b*b-4*a*c)>0]
{
x1=[-b+sqrt (b*b-4*a*c)]/(2*a);
x2=[-b-sqrt (b*b-4*a*c)]/(2*a);
printf("the roots are x1=%f,x2=%f",x1,x2);
}
else
printf("it has imaginary roots");
getch();
}
| Is This Answer Correct ? | 8 Yes | 11 No |
Post New Answer View All Answers
When should a type cast be used?
What does int main () mean?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What are the back slash character constants or escape sequence charactersavailable in c?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Is Exception handling possible in c language?
what do u mean by Direct access files? then can u explain about Direct Access Files?
What is the usage of the pointer in c?
What is a string?
Are the variables argc and argv are always local to main?
How do I convert a string to all upper or lower case?
Are pointers integers in c?
How can you restore a redirected standard stream?
What are header files and what are its uses in C programming?
What does emoji p mean?