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


Please Help Members By Posting Answers For Below Questions

Write a program to print ASCII code for a given digit.

688


What is difference between far and near pointers?

612


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

557


Why do we use return in c?

569


How can I implement a delay, or time a users response, with sub-second resolution?

625






An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

656


What is the difference between pure virtual function and virtual function?

652


Explain what is meant by 'bit masking'?

644


Discuss the function of conditional operator, size of operator and comma operator with examples.

678


What is your stream meaning?

605


Are the outer parentheses in return statements really optional?

577


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

1784


What is the use of bit field?

640


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

634


How can I find the modification date and time of a file?

604