#include<stdio.h>
#include<math.h>
void main()
{
float a,b,c,delta,x,y,root1,root2;
printf("enter the value of first variable");
if(scanf("%f",&a)==1)
{
printf("enter the value of second variable");
if(scanf("%f",&b)==1)
{
printf("enter the value of third variable");
if(scanf("%f",&c)==1)
{
delta=sqrt(pow(b,2)-(4*a*c));
if(delta>0)
{
root1=(-b+delta)/(2*a);
root2=(-b-delta)/(2*a);
printf("\n\n root1=%5.2f",root1);
printf("\n\n root2=%5.2f",root2);
}
else
{
printf("roots are imaginary");
}
}
else
{
printf("error,enter correct value");
}
}
else
{
printf("error,enter the correct value");
}
}
else
{
printf("error,enter coreect value");
}
}
===============================OUTPUT==============================
enter the value of first variable :1.5
enter the value of second variable :3.5
enter the value of third variable :-15
root1= 2.20
root2=-4.54