#include <stdio.h>

#include <conio.h>

#include <math.h>

void main()

{

int a,b,c,i,n,j;

float r,x1,d,x2,e,f,x;

clrscr();

printf("Enter Value for a, b and c: ");

scanf("%d %d %d",&a,&b,&c);

f=(b/(2*a));

r=(b*b)-(4*a*c);

if(r>0)

{

d=sqrt(r);

x=d/(2*a);

x1=-f+x;

x2=-f-x;

printf("x=%.2f, %.2f",x1,x2);

}

else

{

e=-r;

d=sqrt(e);

x=e/(2*a);

printf("x=(%.2f-i%.2f), (%.2f+i%.2f)",f,x,f,x);

}

getch();

}

#include <conio.h>

#include <math.h>

void main()

{

int a,b,c,i,n,j;

float r,x1,d,x2,e,f,x;

clrscr();

printf("Enter Value for a, b and c: ");

scanf("%d %d %d",&a,&b,&c);

f=(b/(2*a));

r=(b*b)-(4*a*c);

if(r>0)

{

d=sqrt(r);

x=d/(2*a);

x1=-f+x;

x2=-f-x;

printf("x=%.2f, %.2f",x1,x2);

}

else

{

e=-r;

d=sqrt(e);

x=e/(2*a);

printf("x=(%.2f-i%.2f), (%.2f+i%.2f)",f,x,f,x);

}

getch();

}

## No comments:

## Post a Comment