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
What is an arrays?
What is const volatile variable in c?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
Explain how do you sort filenames in a directory?
Is calloc better than malloc?
Describe the difference between = and == symbols in c programming?
please give me some tips for the placement in the TCS.
What is the use of the function in c?
Write a Program to accept different goods with the number, price and date of purchase and display them
Why do we use static in c?
What is the size of array float a(10)?
What does *p++ do?
What is the use of printf() and scanf() functions?
Explain union. What are its advantages?
What does sizeof function do?