Solve Equations-001
C Code:
#include<stdio.h>
#include <stdlib.h>
int main()
{
int a1,b1,c1,a2,b2,c2,temp,a,b,x,y ,z;
char x1,y1,x2,y2;
scanf("%d%c%d%c=%d",&a1,&x1,&b 1,&y1,&c1);
scanf("%d%c%d%c=%d",&a2,&x2,&b 2,&y2,&c2);
if(x1!='x'&& x1!='X')
{
temp=a1;
a1=b1;
b1=temp;
}
if(x2!='x'&&x2!='X')
{
temp=a2;
a2=b2;
b2=temp;
}
a=((c1*b2)-(b1*c2))/((a1*b2)-( b1*a2));
b=((a1*c2)-(c1*a2))/((a1*b2)-( b1*a2));
printf("%d %d",a,b);
}
Comments
Post a Comment