Hacker News new | ask | show | jobs
by hallowtech 4932 days ago
I don't understand why this only gets a score of 1:

    static String[] c = { "", "FizzBuzz", "Buzz", "Fizz" };
    public static void main(String[] args)
    {
        for(int i = 1; i <= 100; i++)
        {
            c[0] = ""+i;
            int f = ((int)Math.ceil((i%3)/3.0))+1;
            int b = ((int)Math.ceil((i%5)/5.0))*2;
            System.out.println(c[(f+b)%4]);
        }
    }
1 comments

Because it's huge and this is a code golf challenge?
=\ No point in trying with Java then?
You can do some decent golfing in Java. For improvement, how about removing all the casts, FP arithmetic, everything from Math, etc?