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
Do pointers store the address of value or the actual value of a variable?
Explain what are header files and explain what are its uses in c programming?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
What is an auto variable in c?
What do you understand by normalization of pointers?
Is void a keyword in c?
What is formal argument?
#include
What is s or c?
Who invented b language?
Explain what is the stack?
What is getch c?
Explain union.
What's a good way to check for "close enough" floating-point equality?
i have a written test for microland please give me test pattern