Write a C program to compute the roots of a quadratic equation.
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
float a,b,c,d,x1,x2;
printf("Please Enter the value of a:= ");
scanf("%f",&a);
Printf("Please Enter the value of b:= ");
scanf("%f",&b);
printf("Please Enter the value of c:= ");
scanf("%f",c);
d:=(b*b)-4*a*c;
if(d<0);
printf("No Solutions");
else
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("%f%f",x1,x2);
}
getch();
}
#include<conio.h>
main()
{
clrscr();
float a,b,c,d,x1,x2;
printf("Please Enter the value of a:= ");
scanf("%f",&a);
Printf("Please Enter the value of b:= ");
scanf("%f",&b);
printf("Please Enter the value of c:= ");
scanf("%f",c);
d:=(b*b)-4*a*c;
if(d<0);
printf("No Solutions");
else
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("%f%f",x1,x2);
}
getch();
}