変形Fizz-Buzz問題
Posted feedbacks - 秀丸マクロ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #i = 1;
#a[0] = 1; $b[0] = "hoge";
#a[1] = 3; $b[1] = "Fizz";
#a[2] = 5; $b[2] = "Buzz";
#a[3] = 15; $b[3] = "FizzBuzz";
while( #i <= 20 ) {
call KetaSoroe #i, 2;
insert $$return + ":";
#j = 3;
while( #j >= 0 ) {
if( #i % #a[#j] == 0 ) {
insert $b[#j];
break;
}
#j = #j - 1;
}
insert "\n";
#i = #i + 1;
}
endmacro;
KetaSoroe:
##i = ##2 - strlen( str( ##1 ) );
$$result = "";
if ( ##i >= 0 ) {
while( ##i > 0 ) {
$$result = $$result + " ";
##i = ##i - 1;
}
}
$$result = $$result + str( ##1 );
return $$result;
|



raynstard
#3758()
Rating0/2=0.00
[ reply ]