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 convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
how to find binary of number?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
What is typedef example?
What is the use of static variable in c?
Explain goto?
can any one tel me wt is the question pattern for NIC exam
What do you mean by scope of a variable in c?
If the size of int data type is two bytes, what is the range of signed int data type?
What are the application of void data type in c?
Explain how can I write functions that take a variable number of arguments?
How can I do peek and poke in c?
How does pointer work in c?
What are the header files used in c language?