Originally posted by XanthosNZ
I have no idea what you are doing here. This problem can be bruteforced (there are 2*(9-m)*(9-n) mxn rectangles on a chessboard where m!=n [if so then remove the 2*]).
However a more elegant solution is that a chessboard has 9 vertical boundaries and 9 horizontal boundaries and to form a rectangle we choose any two of each.
There are 36 ways of choosing 2 from 9 (9C2) and therefore there are 36^2 rectangles.
36^2 = 1296
I realised I made a mistake in my bruteforce approach. Wrote an algorithm that did indeed get 1296. If you are talking about oblongs, it is 1092 (previously assumed that rectangles aren't squares).
I like your elegant solution though.
EDIT (short delphi code of bruteforce if anyone is interested):
procedure TForm1.Button1Click(Sender: TObject);
n, m, total: integer;
total := 0;
for n := 1 to 8 do
for m := 1 to 8 do
if m n then // this is just for oblongs. For all rectangles, remove this line
total := total + (m*n);
EDIT2: meant to be an "m greater or less than n" in code, but did not render here, as well as indentation.