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

Explain is it better to bitshift a value than to multiply by 2?

684


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1507


Is c dynamically typed?

648


How many parameters should a function have?

638


What is difference between scanf and gets?

587






What is the advantage of c?

582


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

1816


What is a loop?

530


What does typeof return in c?

615


Explain do array subscripts always start with zero?

728


explain what is fifo?

602


What does void main () mean?

699


What happens if a header file is included twice?

564


If the size of int data type is two bytes, what is the range of signed int data type?

563


Explain the properties of union. What is the size of a union variable

695