You've got an easy one for today. Create a program that iterates over the numbers [1-100] (inclusive). If a number is divisible by 1 print "problem". If a number is divisible by 5 print "of". If a number is divisible by 25 print "the". If a number is divisible by 100 print "day". Thus when you reach 100 your final line of output should be "problemoftheday".
Comments:
Daniel - 10 years, 6 months ago
My very simple C# solution
I shall try to make it shorter if I have time later.
reply permalink
Daniel - 10 years, 6 months ago
A little shorter
reply permalink
Max Burstein - 10 years, 6 months ago
You're going to love tomorrow's problem
reply permalink
Anonymous - 10 years, 6 months ago
Python
reply permalink
Sellyme - 10 years, 6 months ago
I had broadly the same solution, but for efficiency, I nested the %25 and %100 statements. If i%5 isn't 0, you don't need to test i%25, and if i%25 is 0, you don't need to test i%100.
reply permalink
Anonymous - 10 years, 6 months ago
reply permalink