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
Why void main is used in c?
Explain why can’t constant values be used to define an array’s initial size?
What does & mean in scanf?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
What is static and volatile in c?
What are qualifiers and modifiers c?
Give basis knowledge of web designing ...
How can I do serial ("comm") port I/O?
can any one provide me the notes of data structure for ignou cs-62 paper
How many keywords are there in c?
Why isnt any of this standardized in c?
Can we declare variable anywhere in c?
Why do we use main function?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
What does the && operator do in a program code?