#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,d,x1,x2;
printf(" Enter the cofficient of a,b, c ");
scanf("%f %f %f",&a,&b,&c);
d=b*b-4*a*c;
if(d>0)
{
x1=(-b-sqrt(d))/(2*a);
x2=(-b+sqrt(d))/(2*a);
printf("\n Root are Real and Unequal : %f , %f",x1,x2);
}
else
if(d==0)
{
x1=-b/(2*a);
printf("\n Root are Real and equal : %f",x1);
}
else
printf(" No real root ,Root are complex");
getch();
}
#include<stdio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,d,x1,x2;
printf(" Enter the cofficient of a,b, c ");
scanf("%f %f %f",&a,&b,&c);
d=b*b-4*a*c;
if(d>0)
{
x1=(-b-sqrt(d))/(2*a);
x2=(-b+sqrt(d))/(2*a);
printf("\n Root are Real and Unequal : %f , %f",x1,x2);
}
else
if(d==0)
{
x1=-b/(2*a);
printf("\n Root are Real and equal : %f",x1);
}
else
printf(" No real root ,Root are complex");
getch();
}
No comments:
Post a Comment
Please write your doubts