#include<stdio.h>
#include<math.h>
int main(){
int a,b,c;
double x,y,d;
printf("Enter a , b , c of quadratic equation: ");
scanf("%d%d%d",&a,&b,&c);
//calculating the value of d
d = sqrt(b * b - 4 * a * c);
//Checking real solution is possible or not
if(d<0){
printf("Real number root is not possible");
exit(1);
}
//finding the root of quadractic equation
x = (-b + d) / 2 * a;
y = (-b - d) / 2 * a;
//printing the root of the quadractic equation
printf("Solution of quadratic equation are %lf , %lf",x,y);
return 0;
}
0 comments :
Post a Comment