int main (void)

{

double a0, b0, c0, a1, b1, c1, topx, topy, botx, boty, x, y, diffa, diffb, diffc, diffx, diffy;

a0 = 0.0;

b0 = 0.0;

c0 = 0.0;

a1 = 0.0;

b1 = 0.0;

c1 = 0.0;

topx = 0.0;

topy = 0.0;

botx = 0.0;

boty = 0.0;

x = 0.0;

y = 0.0;

diffa = 0.0;

diffb = 0.0;

diffc = 0.0;

diffx = 0.0;

diffy = 0.0;

printf("\n\nWelcome to the 2X2 linear equation intercept calculator");

printf("\n\nThis is a program designed to find the x and y co-ordinates of the\nintercept between two equations on the number plane.");

printf("\n\nYou will be asked to enter the co-efficients a, b and c of an equation\nthat is in the form ax + by = c (ie 2x + 5y = 10, a=2, b=5, and c=10)");

printf("\n\n\nPlease enter the co-efficients a, b and c for equation 1 in that order\nseperated by a space: ");

scanf("%lf %lf %lf", &a0, &b0, &c0);

while((a0>-0.0000001) && (a0<0.0000001)){

printf("Variable 'a' not entered correctly, please enter 'a' again now: ");

scanf("%lf", &a0);

}

while((b0>-0.0000001) && (b0<0.0000001)){

printf("Variable 'b' not entered correctly, please enter 'b' again now: ");

scanf("%lf", &b0);

}

while((c0>-0.0000001) && (c0<0.0000001)){

printf("Variable 'c' not entered correctly, please enter 'c' again now: ");

scanf("%lf", &c0);

}

printf("\n\n\nPlease enter the co-efficients a, b and c for equation 2 in that order\nseperated by a space: ");

scanf("%lf %lf %lf", &a1, &b1, &c1);

while((a1>-0.0000001) && (a1<0.0000001)){

printf("Variable 'a' not entered correctly, please enter 'a' again now: ");

scanf("%lf", &a1);

}

while((b1>-0.0000001) && (b1<0.0000001)){

printf("Variable 'b' not entered correctly, please enter 'b' again now: ");

scanf("%lf", &b1);

}

while((c1>-0.0000001) && (c1 < 0.0000001)){

printf("Variable 'c' not entered correctly, please enter 'c' again now: ");

scanf("%lf", &c1);

}

topx = (c0*b1)-(c1*b0);

botx = (a0*b1)-(a1*b0);

topy = (a0*c1)-(a1*c0);

boty = (a0*b1)-(a1*b0);

diffa = (a0-a1);

diffb = (b0-b1);

diffc = (c0-c1);

diffx = (diffa-diffb);

diffy = (diffa-diffc);

if((botx<0.0000001) && (botx>-0.0000001)){

printf("The equations do not have an \nintercept as they are parrallel");

}else if((boty<0.0000001) && (boty>-0.0000001)){

printf("The equations do not have an \nintercept as they are parrallel");

}else if((diffx>-0.0000001) && (diffx<0.0000001)){

printf("The equations are the same line, and therefore share an infinite number of intercepts");

}else if((diffy>-0.0000001) && (diffy<0.0000001)){

printf("The equations are the same line, and therefore share an infinite number of intercepts");

}else{

x = topx/botx;

y = topy/boty;

printf("The equations intercept at co-ordinates");

}

printf("x = %lf", topx);

return (0);

}