Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/McNuggets-problem/Modula-2/mcnuggets-problem.mod2
Normal file
26
Task/McNuggets-problem/Modula-2/mcnuggets-problem.mod2
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
MODULE McNuggets;
|
||||
FROM InOut IMPORT WriteCard, WriteString, WriteLn;
|
||||
|
||||
CONST Max = 100;
|
||||
VAR a, b, c: CARDINAL;
|
||||
nugget: ARRAY [0..Max] OF BOOLEAN;
|
||||
|
||||
BEGIN
|
||||
FOR a := 0 TO Max DO
|
||||
nugget[a] := FALSE;
|
||||
END;
|
||||
|
||||
FOR a := 0 TO Max BY 6 DO
|
||||
FOR b := a TO Max BY 9 DO
|
||||
FOR c := b TO Max BY 20 DO
|
||||
nugget[c] := TRUE;
|
||||
END;
|
||||
END;
|
||||
END;
|
||||
|
||||
a := 100;
|
||||
REPEAT DEC(a); UNTIL NOT nugget[a];
|
||||
WriteString("Maximum non-McNuggets number: ");
|
||||
WriteCard(a, 2);
|
||||
WriteLn();
|
||||
END McNuggets.
|
||||
Loading…
Add table
Add a link
Reference in a new issue