A slightly different method (simply because I felt like it).
cfscript
for (i=1; i LTE 100; i=i+1)
{
if (i\3 EQ i/3) WriteOutput('fizz');
if (i\5 EQ i/5) WriteOutput('buzz');
if (i\5 NEQ i/5 AND i\3 NEQ i/3) WriteOutput(i);
Which, in a literal since, says that you would print 'Fizz' instead of
the number, but print 'Buzz' and 'FizzBuzz' with the number.
Cutter
Not quite. Logically it says print 'Fizz' instead of the number,
'Buzz' with the number and 'FizzBuzz' _without_ the number. The rest
is just typing/testing
there is no truth. Only a spec,
which is an entirely different thing.
Jaime Metcher
-Original Message-
From: Adkins, Randy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 28 February 2007 11:40 PM
To: CF-Talk
Subject: RE: Fizzbuzz. Simple programming problems.
I think this is a classic case
Which, in a literal since, says that you would print 'Fizz' instead of
the number, but print 'Buzz' and 'FizzBuzz' with the number.
Cutter
_
http://blog.cutterscrossing.com
Paul Vernon wrote:
snip
I don't see anything in the spec that says instead of
snip
It's on line
To: CF-Talk
Subject: Re: Fizzbuzz. Simple programming problems.
Which, in a literal since, says that you would print 'Fizz' instead of
the number, but print 'Buzz' and 'FizzBuzz' with the number.
Cutter
_
http://blog.cutterscrossing.com
Paul Vernon wrote:
snip
I don't see anything
I would do it almost exactly the same way that you did it, except that I
read the requirements differently.
You are outputting fizzbuzz, buzz and fizz instead of i. I don't see
anything in the spec that says instead of, so I presume that its in
addition to. I would print out the number on
Message-
From: Judah McAuley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 28 February 2007 1:17 PM
To: CF-Talk
Subject: Re: Fizzbuzz. Simple programming problems.
I would do it almost exactly the same way that you did it, except that I
read the requirements differently.
You are outputting fizzbuzz
snip
I don't see anything in the spec that says instead of
snip
It's on line three below...
Here's the specific one he mentioned:
Write a program that prints the numbers from 1 to 100.
But for multiples of three print Fizz instead of the number.
For the multiples of five print Buzz.
For
Good call. Just goes to show that I shouldn't interpret specs at the end
of the day :)
Judah
Paul Vernon wrote:
snip
I don't see anything in the spec that says instead of
snip
It's on line three below...
Here's the specific one he mentioned:
Write a program that prints the numbers
9 matches
Mail list logo