Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Gapful-numbers/XPL0/gapful-numbers.xpl0
Normal file
31
Task/Gapful-numbers/XPL0/gapful-numbers.xpl0
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
func Gapful(N0); \Return 'true' if gapful number
|
||||
int N0, N, First, Last;
|
||||
[N:= N0;
|
||||
N:= N/10;
|
||||
Last:= rem(0);
|
||||
repeat N:= N/10;
|
||||
First:= rem(0);
|
||||
until N = 0;
|
||||
N:= First*10 + Last;
|
||||
return rem(N0/N) = 0;
|
||||
];
|
||||
|
||||
proc ShowGap(Start, Limit); \Display gapful numbers
|
||||
int Start, Limit, Count, N;
|
||||
[Text(0, "First "); IntOut(0, Limit); Text(0, " gapful numbers starting from ");
|
||||
IntOut(0, Start); Text(0, ":^m^j");
|
||||
Count:= 0; N:= Start;
|
||||
loop [if Gapful(N) then
|
||||
[IntOut(0, N); ChOut(0, ^ );
|
||||
Count:= Count+1;
|
||||
if Count >= Limit then quit;
|
||||
];
|
||||
N:= N+1;
|
||||
];
|
||||
CrLf(0);
|
||||
];
|
||||
|
||||
[ShowGap(100, 30);
|
||||
ShowGap(1_000_000, 15);
|
||||
ShowGap(1_000_000_000, 10);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue