{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software) for windows 7 like Code::Blocks, dev c++ . Download dev c++ its free and install it in your computer.open dev c++ go to file-->new-->source file.}
#include<stdio.h>
#include<math.h>
#include<conio.h>
main()
{
float a,b,c,dis,r1,r2;
printf("if equ is ax^2+bx+c=0 input a,b and c and find x\n");
scanf("%f%f%f",&a,&b,&c);
dis=b*b-4*a*c;
if(dis<0)
printf("\n root is imaginary\n");
else
{
r1=(-b+sqrt(dis))/(2.0*a);
r2=(-b-sqrt(dis))/(2.0*a);
printf("root one = %5.2f\n root two = %5.2f\n",r1,r2);
}
getch();
}
For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}
IS IT HELPFIL? comment.
No comments:
Post a Comment