RosettaCodeData/Task/FizzBuzz/Eiffel/fizzbuzz.e

34 lines
549 B
Text
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
class
APPLICATION
2015-11-18 06:14:39 +00:00
2015-02-20 00:35:01 -05:00
create
make
2015-11-18 06:14:39 +00:00
feature
2015-02-20 00:35:01 -05:00
make
do
fizzbuzz
end
fizzbuzz
2015-11-18 06:14:39 +00:00
--Numbers up to 100, prints "Fizz" instead of multiples of 3, and "Buzz" for multiples of 5.
--For multiples of both 3 and 5 prints "FizzBuzz".
do
across
1 |..| 100 as c
loop
if c.item \\ 15 = 0 then
io.put_string ("FIZZBUZZ%N")
elseif c.item \\ 3 = 0 then
io.put_string ("FIZZ%N")
elseif c.item \\ 5 = 0 then
io.put_string ("BUZZ%N")
else
io.put_string (c.item.out + "%N")
end
2015-02-20 00:35:01 -05:00
end
end
2015-11-18 06:14:39 +00:00
2015-02-20 00:35:01 -05:00
end