Write a function called FooBar that takes input integer n and prints all the numbers from 1 upto n in a new line. If the number is divisible by 3 then print "Foo", if the number is divisible by 5 then print "Bar" and if the number is divisible by both 3 and 5, print "FooBar". Otherwise just print the number. for example FooBar(15) should print as follows: 1 2 Foo 4 Bar Foo 7 8 Foo Bar 11 Foo 13 14 FooBar
Guys PLZ PLZ PLZ give me the complete answer in RUBY!!! i am using an online cloud computing environment to write code and I need this answer to a quiz ASAP!!!
Aucun commentaire:
Enregistrer un commentaire