Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/Humble-numbers/XPL0/humble-numbers.xpl0
Normal file
37
Task/Humble-numbers/XPL0/humble-numbers.xpl0
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
func Humble(N); \Return 'true' if N is a humble number
|
||||
int N;
|
||||
[if N = 1 then return true;
|
||||
if rem(N/2) = 0 then return Humble(N/2);
|
||||
if rem(N/3) = 0 then return Humble(N/3);
|
||||
if rem(N/5) = 0 then return Humble(N/5);
|
||||
if rem(N/7) = 0 then return Humble(N/7);
|
||||
return false;
|
||||
];
|
||||
|
||||
int N, C, D, P;
|
||||
[N:= 1; C:= 0;
|
||||
loop [if Humble(N) then
|
||||
[C:= C+1;
|
||||
IntOut(0, N); ChOut(0, ^ );
|
||||
if C >= 50 then quit;
|
||||
];
|
||||
N:= N+1;
|
||||
];
|
||||
CrLf(0);
|
||||
D:= 1; P:= 10; N:= 1; C:= 0;
|
||||
loop [if Humble(N) then
|
||||
[if N >= P then
|
||||
[IntOut(0, D);
|
||||
Text(0, ": ");
|
||||
IntOut(0, C);
|
||||
CrLf(0);
|
||||
C:= 0;
|
||||
D:= D+1;
|
||||
if D > 9 then quit;
|
||||
P:= P*10;
|
||||
];
|
||||
C:= C+1;
|
||||
];
|
||||
N:= N+1;
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue