- def com(n)
- for i in 1..(n-1)
- if n%i==0
- factor=i
- end
- end
- if factor>1
- puts "The Number is a Composite Number!"
- else
- puts "This is not a Composite Number!"
- end
- end
- #该片段来自于http://www.codesnippet.cn/detail/070520133174.html
来源: http://www.codesnippet.cn/detail/070520133174.html