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
Is null always defined as 0(zero)?
What is the difference between procedural and functional programming?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What is pointer to pointer in c?
In which language linux is written?
What is the difference between near, far and huge pointers?
What are logical errors and how does it differ from syntax errors?
How are structure passing and returning implemented?
What are type modifiers in c?
Explain how do you list a file’s date and time?
How can I list all of the predefined identifiers?
What is scope of variable in c?
Explain what is operator promotion?
What is function definition in c?
What does a function declared as pascal do differently?