Friday, 11 May 2012

Roots of Quadratic Equation


#include <stdio.h>
#include <conio.h>
#include <math.h>
void quad(int,int,int);
void main()
{
int a,b,c;
clrscr();
printf("Enter Values Of a, b & c : ");
scanf("%d%d%d",&a,&b,&c);
quad(a,b,c);
}
void quad(int a,int b,int c)
{
float d,e,f;
f=sqrt((b*b)-(4*a*c));
d=(((-1)*b)+f)/(float)(2*a);
e=(((-1)*b)-f)/(float)(2*a);
printf("Roots of euaation = %.2f AND  %.2f",d,e);
getch();
}

No comments:

Post a Comment