RosettaCodeData/Task/Population-count/EasyLang/population-count.easy

31 lines
396 B
Text
Raw Permalink Normal View History

2023-12-16 21:33:55 -08:00
func popcnt x .
while x > 0
r += x mod 2
x = x div 2
.
return r
.
2025-06-11 20:16:52 -04:00
proc show3 .
2023-12-16 21:33:55 -08:00
write "3^n:"
bb = 1
for i = 1 to 30
write " " & popcnt bb
bb *= 3
.
print ""
.
2025-06-11 20:16:52 -04:00
proc show s$ x .
2023-12-16 21:33:55 -08:00
write s$
while n < 30
if popcnt i mod 2 = x
n += 1
write " " & i
.
i += 1
.
print ""
.
show3
show "evil:" 0
show "odious:" 1