neha9t
7/25/2016 - 10:21 AM

Crackle-Pop Problem

Crackle-Pop Problem

# Write a program that prints out the numbers 1 to 100 (inclusive). 
# If the number is divisible by 3, print Crackle instead of the number. 
# If it's divisible by 5, print Pop. If it's divisible by both 3 and 5, print CracklePop. 
# You can use any language.

	(1..100).each do |num|
		#binding.pry
		if (num%5==0) && (num%3==0)
				puts 'CracklePop'
		elsif (num%3==0)
	  		puts	'Crackle'
		elsif (num%5==0)
		 		puts 'Pop'
		else
			puts num
		end	
	end