Advertisement
Qpel

Untitled

Jan 8th, 2018
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. sum=0
  2. for i in 100..9999
  3. n=i
  4. while n>0
  5. a=n%10
  6. b=n/10
  7. n=n/10
  8. sum=sum+a
  9. end
  10. d=sum*sum
  11. if i==d then
  12. puts "#{i} "
  13. end
  14.  
  15. end
  16.  
  17. puts "pabaiga"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement