初学ruby

2016-12-16  本文已影响0人  seafruit

非常惭愧的说一句,我做了20道afar同学推荐的ruby_coans测试学习题,然后就开始做作业,时间太紧,没来得及好好学习

Write a program that outputs the string representation of numbers from 1 to n.
But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”.

["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]
ruby1.png
上一篇 下一篇

猜你喜欢

热点阅读