Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- k=0
- for x in 100..999
- n=x
- suma=0
- while n!=0
- p=n%10
- suma+=p
- n=n/10
- end
- dal=0
- for y in 1..suma-1
- if suma%y==0
- dal+=y
- end
- end
- if dal==suma
- puts "#{x} skaiciaus skaitmenu suma yra tobulas skaicius"
- k=k+1
- end
- end
- puts "Viso tokiu skaiciu yra #{k}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement