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
List some of the static data structures in C?
What does printf does?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What is the process to generate random numbers in c programming language?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
How can my program discover the complete pathname to the executable from which it was invoked?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
What is difference between function overloading and operator overloading?
What is a const pointer?
How can I find the modification date and time of a file?
Where is c used?
What are the types of arrays in c?
Explain the difference between structs and unions in c?
What is linear search?
Is there any data type in c with variable size?