write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / rohit
#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 ? | 29 Yes | 21 No |
Post New Answer View All Answers
Explain how do you declare an array that will hold more than 64kb of data?
Explain how can I make sure that my program is the only one accessing a file?
Describe newline escape sequence with a sample program?
What is the use of parallelize in spark?
Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)
What is merge sort in c?
What does s c mean on snapchat?
What is a stream in c programming?
Explain how are portions of a program disabled in demo versions?
What are the applications of c language?
Does c have class?
How can I sort more data than will fit in memory?
Lists the benefits of c programming language?
Explain zero based addressing.
Is c programming hard?