write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / lazy guyz
#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 ? | 1 Yes | 7 No |
Post New Answer View All Answers
What are the two types of functions in c?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
What is the difference between union and anonymous union?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
what is different between auto and local static? why should we use local static?
Explain 'far' and 'near' pointers in c.
Is calloc better than malloc?
write a program to print data of 5 five students with structures?
Explain how can you check to see whether a symbol is defined?
What are global variables?
What is static and volatile in c?
define string ?
Define macros.
What are header files in c?
Are pointers integer?