Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

zomg one-liner hell

Code
for (int a = 1; a <= 500; a++)
            for (int b = 1; b <= 500; b++)
                for (int c = 1; c <= 500; c++)
                    if (a < b && b < c)
                        if ((Math.pow(a, 2) + Math.pow(b, 2)) == Math.pow(c, 2))                    
                            if (a+b+c == 1000)
                                return (new int[] {a, b, c});

wat is this madness
Nested for loops and if loops...????
[Image: JcVeD.png]

“Be Who You Are and Say What You Feel Because Those Who Mind Don't Matter and Those Who Matter Don't Mind.” - Dr. Seuss
An attempted solution for http://projecteuler.net/problem=9 (is what it is)
See http://en.wikipedia.org/wiki/Pythagorean_triple


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Help] by ClumsyJul 30, 2026 06:27 AM 1 174 Jul 30, 2026 06:27 AM
Last Post: XtremeDiscount
[Help] by javierpenaApr 13, 2023 07:42 PM 1 84 Apr 13, 2023 07:42 PM
Last Post: Ducky
[Perl] by bsdpunkMar 15, 2011 09:54 PM 0 79 Mar 15, 2011 09:54 PM
Last Post: bsdpunk