Archive:Roots of an equation: Difference between revisions
Appearance
wikademia>Milan New page: <pre>solution of degree 2 eqn #include<stdio.h> #include<conio.h> void main() { float a1,b1,c1,a2,b2,c2,x,y; clrscr(); printf("enter co-eff's of both the equations"); scanf("%f%f%f%f%f%f"... |
wikademia>JWSchmidt cat |
||
| Line 14: | Line 14: | ||
getch(); | getch(); | ||
} | } | ||
</pre> | |||
[[Category:C source code examples]] | |||
Revision as of 14:07, 19 December 2006
solution of degree 2 eqn
#include<stdio.h>
#include<conio.h>
void main()
{
float a1,b1,c1,a2,b2,c2,x,y;
clrscr();
printf("enter co-eff's of both the equations");
scanf("%f%f%f%f%f%f",&a1,&b1,&c1,&a2,&b2,&c2);
y=((c2*a1)-(c1*a2))/((a1*b2)-(a2*b1));
x=((c1*b2)-(c2*b1))/((a1*b2)-(a2*b1));
printf("x=%f\n y=%f\n",x,y);
getch();
}