You are on page 1of 1

#include<stdio.

h>

#include<math.h>

void main()

int x,y,z,d;

float x1,x2;

printf("Input the value of x y and z");

scanf("%d%d%d",&x,&y,&z);

d=y*y - 4*x*z;

if(d==0)

printf("both roots are equal");

x1 = -y/(2.0*x);

x2 = x1;

printf("%f",x1);

printf("%f",x2);

else if(d>0)

printf("both roots are real and diff \n");

x1 = (-y+sqrt(d))/(2*x);

x2 = (-y-sqrt(d))/(2*x);

else

printf("roots are not possible not a quadratic equation");

getch();

You might also like