All pastes #830678 Raw Edit

Solving intersection of linear e

public text v1 · immutable
#830678 ·published 2007-12-24 04:24 UTC
rendered paste body
program prog;
uses wincrt;
var
		m1, m2, b1, b2: real;
		x, y: real;

begin	
	write('Enter m1: ');
	readln(m1);
	
	write('Enter b1: ');
	readln(b1);
	
	write('Enter m2: ');
	readln(m2);
	
	write('Enter b2: ');
	readln(b2);
	
	if (m1 = m2) and (b1 = b2) then begin
		writeln('Infinite solutions');
	end 
	else if (m1 = m2) then begin
		writeln('No solution');
	end
	else begin
		x := (b2 - b1) / (m1 - m2);
		y := m1*x + b1;
		writeln('Intersection is at (', x:0:5, ', ', y:0:5, ')');
	end
end.