(* The Great Win32 Language Shootout http://dada.perl.it/shootout/ contributed by Isaac Gouy (Modula2 novice) To build: xc =m nestedloop To run: nestedloop 16 *) MODULE NestedLoop; <* coverflow - *> (* Prefer unqualified procedures *) FROM LanguageShootout IMPORT N; FROM STextIO IMPORT WriteLn; FROM SWholeIO IMPORT WriteCard; VAR count: CARDINAL; n, g, h, i, j, k, l: CARDINAL; BEGIN n := N(); count := 0; FOR g := 1 TO n DO FOR h := 1 TO n DO FOR i := 1 TO n DO FOR j := 1 TO n DO FOR k := 1 TO n DO FOR l := 1 TO n DO INC(count); END; END; END; END; END; END; WriteCard(count,1); WriteLn; END NestedLoop.