(* Modula-2 on XDS Modula-2 *) (* mod2\console.prj *) MODULE ConsoleApp2; FROM IO IMPORT WrStr, WrLn, WrInt, RdInt, RdKey; IMPORT Window; (* TopSpeed tool*) PROCEDURE openTxtWin(VAR W1: Window.WinType); VAR WD : Window.WinDef ; BEGIN WITH WD DO X1 := 0 ; Y1 := 0 ; X2 := 79 ; Y2 := 24 ; Foreground := Window.White ; Background := Window.Blue ; CursorOn := TRUE ; WrapOn := TRUE ; Hidden := FALSE ; FrameOn := TRUE ; FrameDef := Window.SingleFrame ; FrameFore := Window.LightMagenta ; FrameBack := Window.Cyan ; END ; W1 := Window.Open(WD) ; END openTxtWin; VAR i1, i2, i3, imax: INTEGER; i : INTEGER; W1 : Window.WinType; ch : CHAR; BEGIN openTxtWin(W1); WrStr("Modula-2 console application 10-3-2016"); WrLn; WrStr("Fibonacci's series"); WrLn; WrStr("Enter imax>"); imax:= RdInt(); WrLn; i1 := 1; i2 := 1; WrStr("Answer is "); WrInt(i1,1); WrStr(", "); WrInt(i2,1); FOR i := 1 TO imax DO i3 := i1 + i2; WrStr(", "); WrInt(i3,1); i2 := i1; i1 := i3; END; WrStr(", Done!"); WrLn; ch:= RdKey(); Window.Close(W1); END ConsoleApp2.