daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Oct 18th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def lucky_sevens(*numbers)
  2. istrue = false
  3. sum = 0
  4. i = 0
  5. while i < numbers.length
  6. num = numbers[i]
  7. sum = num + sum
  8. i += 1
  9. end
  10. if sum == 7
  11. istrue = true
  12. end
  13. return istrue
  14. end
  15.  
  16. puts lucky_sevens(1,2,3,12)
  17. puts lucky_sevens(1,2,3,1)
  18. puts lucky_sevens(1,2,3,1,2,2,1,7,4,7,0,7,321,)
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