美文网首页
Hello World

Hello World

作者: DaliVan | 来源:发表于2015-04-06 12:36 被阅读0次

    Hello World!

    <code>
    This demo is written by Markdown
    </code>
    Tips for u:
    Be careful
    Take easy

    This is a Java-Language code demo:
    class Solution {
        public ArrayList<String> fizzBuzz(int n) {
            ArrayList<String> results = new ArrayList<String>();
            for (int i = 1; i <= n; i++) {
                if (i % 15 == 0) {
                    results.add("fizz buzz");
                } else if (i % 5 == 0) {
                    results.add("buzz");
                } else if (i % 3 == 0) {
                    results.add("fizz");
                } else {
                    results.add(String.valueOf(i));
                }
            }
            return results;
        }
    }
    

    相关文章

      网友评论

          本文标题:Hello World

          本文链接:https://www.haomeiwen.com/subject/lqqzxttx.html