write a c program to find the roots of a quadratic equation
ax2 + bx + c = 0
Answer Posted / adde.c
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,x1,x2,y,z;
printf("Please Enter 3 inputs of a,b,c in This
format:a<space>b<space>c=");
scanf("%f%f%f",&a,&b,&c);
y=(b*b-4*a*c);
if(a==0&&b==0)
{
printf("There is No Solution!!!!");
}
else if(a==0&&b!=0)
{
x1=(-1)*c/b;
printf("x1=%f",x1);
}
else
{
if(y>=0)
{
z=sqrt(y);
x1=((-1)*b+z)/(2*a);
x2=((-1)*b-z)/(2*a);
printf("Value of x1=%f & x2=%f",x1,x2);
}
else
{
printf("Your Equiation Showing an imaginery
value.....!!!!!!");
}
}
getch();
}
Is This Answer Correct ? | 12 Yes | 15 No |
Post New Answer View All Answers
Write a program to print ASCII code for a given digit.
What is difference between far and near pointers?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
Why do we use return in c?
How can I implement a delay, or time a users response, with sub-second resolution?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What is the difference between pure virtual function and virtual function?
Explain what is meant by 'bit masking'?
Discuss the function of conditional operator, size of operator and comma operator with examples.
What is your stream meaning?
Are the outer parentheses in return statements really optional?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
What is the use of bit field?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
How can I find the modification date and time of a file?