Jan 28, 2013

Computing real roots

Computing real roots

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,d,x1,x2;
printf("a,b,c=?");
scanf("%f%f%f",&a,&b,&c);
d=sqrt(b*b-4*a*c);
x1=(-b+d)/(2*a);
x2=(-b-d)/(2*a);
printf("x1=%.2f\t x2=%.2f",x1,x2);
getch();
}

No comments:

Post a Comment

Thank you for visit this site. You will get many programming news from here and learn programming very easily.

Popular Posts