Advertisement
nRikee

[Kata] Fizz Buzz

Jan 21st, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | None | 0 0
  1. -- Kata as seen in http://www.solveet.com/exercises/Kata-FizzBuzz/11
  2.  
  3. ------- [[ Métodos ]] ---------
  4. function fizz( n )    
  5.     if n % 15 == 0    then     print "FizzBuzz"
  6.     elseif ( n % 3 == 0 ) then     print "Fizz"  
  7.     elseif ( n % 5 == 0 ) then     print "Buzz"        
  8.     else print ( n )  
  9.     end
  10. end
  11.  
  12. ------- [[ Main ]] ---------
  13. for i =0, 100 do
  14.     fizz ( i )
  15.     i = i+1
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement