int main()
{
float a, b, c, d, r, R;
printf("enter a,b,c= ");
scanf("%f%f%f ",&a,&b,&c);
d=(b*b)-(4*a*c);
if (d>0)
{
r= (-b- sqrt(d))/2*a;
R= (-b+ sqrt(d))/2*a;
printf("the roots are =%.2f, %.2f", r, R);
}
else if (d==0)
{
R= -b/2*a;
printf("the roots are equal= %.2f",R);
}
else
printf("roots are irrational");
return 0;
}
How scanf is handling input? In console I have to write input two times. Why is it happening?