SHARE
TWEET

Untitled

a guest Jul 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // n=5, k=3, i=1 // result 2
  2.  
  3. function get_last_kid(n,k,i)
  4. {
  5. if(i==1)
  6. {
  7. return (k%n); //returns (toys/nunmber of kids)
  8. }
  9. else
  10. {
  11. return (k%n)+i;
  12. }
  13. }
  14.  
  15. alert( get_last_kid(3,7,3) )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top