I wanna learn programming. (40)

26 Name: #!/usr/bin/anonymous : 2008-04-20 15:19 ID:NeaQvXmw

>>18
Another way would be to compute x^2 + y^2 + z^2 - min(x, y, z)^2 where min(x, y, z) is defined as follows:

x if(x <= y and x <= z)
y if(y <= x and y <= z)
z if(z <= x and z <= y)

Dunno if there's a slicker way to test for the minimum of more than simply two numbers, but it's not bad for a naive function.

This thread has been closed. You cannot post in this thread any longer.