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
Explain is it better to bitshift a value than to multiply by 2?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
Is c dynamically typed?
How many parameters should a function have?
What is difference between scanf and gets?
What is the advantage of c?
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 []);
What is a loop?
What does typeof return in c?
Explain do array subscripts always start with zero?
explain what is fifo?
What does void main () mean?
What happens if a header file is included twice?
If the size of int data type is two bytes, what is the range of signed int data type?
Explain the properties of union. What is the size of a union variable