Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Golf Challenge: FizzBuzz

by Moron (Curate)
on Mar 02, 2007 at 17:36 UTC ( #602915=note: print w/replies, xml ) Need Help??


in reply to Golf Challenge: FizzBuzz

Or the slightly simplistic version that uses a precomputed LCM of 15:
print map $_%15?($_%5?($_%3?"$_\n":"fizz\n"):"buzz\n"):"fizzbuzz\n",(1 +..100);
update: typo corrected - thx liverpole

-M

Free your mind

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://602915]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2016-12-06 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (108 votes). Check out past polls.