Created
May 16, 2017 17:32
-
-
Save antranigv/087154dae1cada0a8965e88ca725ac0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MODULE subsum; | |
IMPORT Out, Modules; | |
VAR s : POINTER TO ARRAY OF LONGINT; i : LONGINT; | |
PROCEDURE Check ( a : ARRAY OF LONGINT ) : BOOLEAN; | |
VAR i , sum : LONGINT; | |
BEGIN | |
sum := 0; | |
FOR i:=0 TO LEN(a) - 1 DO | |
IF a[i] = 0 THEN RETURN TRUE END; | |
sum := sum + a[i]; | |
END; | |
Out.Int(sum, 0); Out.Ln; | |
IF sum = 0 THEN RETURN TRUE ELSE RETURN FALSE END; | |
END Check; | |
BEGIN | |
NEW(s, Modules.ArgCount - 1); | |
FOR i:=0 TO LEN(s^) - 1 DO | |
Modules.GetIntArg(SHORT(i) + 1, s^[i]); | |
END; | |
Out.String("Hello World"); Out.Ln; | |
IF Check(s^) THEN Out.String("True") ELSE Out.String("False") END; Out.Ln; | |
END subsum. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment