Anonymous user
FizzBuzz/AWK: Difference between revisions
m
→Example program 2: link to General_FizzBuzz#AWK
(→Custom FizzBuzz: Example 2) |
m (→Example program 2: link to General_FizzBuzz#AWK) |
||
Line 179:
===Example program 2===
;Input: for the generator-program at [[General_FizzBuzz#AWK]]:
<pre>105
3 Fizz
5 Buzz
7 Baxx</pre>
<lang AWK>BEGIN {print "# CustomFizzBuzz:"} ▼
▲<lang AWK>BEGIN {print "# CustomFizzBuzz:"}
$1 % 3 == 0 {x = x "Fizz"}
$1 % 5 == 0 {x = x "Buzz"}
$1 % 7 == 0 {x = x "Baxx"}
!x {print $1; next}
{print " ", x; x=""}
END {print "# Done."}</lang>
|