Jump to content

Simplifying Number


Err
 Share

Recommended Posts

function simplifyNum($num) {  $num = ($num % 2 === 0) ? simplifyNum($num/2) : $num;  return $num;}$num = simplifyNum($num);

If I put in 10, it does not simplify the number down to 5. It stays 10. Why?Never mind. This works, I was just calling it wrong.

Edited by Err
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...