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);
                WriteOutput('<br/>');
        }
</cfscript>

> I was reading an article titled (http://www.codinghorror.
> com/blog/archives/000781.html). The article talked about programmers 
> applying for positions and not being able to write code FOR the 
> position for which they're applying. Anyway, the author came up with a 
> series of small coding challenges meant to prove that the applicant 
> could in fact write code.
> 
> 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 numbers which are multiples of both three and five print 
> "FizzBuzz".
> 
> Here's what I came up with, I'd be interested in seeing what you guys 
> might come up with. It took me about 4 or 5 minutes.
> 
> <cfoutput>
>       <cfloop index="i" from="1" to="100">
>               <cfif NOT i MOD (3*5)>
>                       fizzbuzz
>               <cfelseif NOT i MOD 5>
>                       buzz
>               <cfelseif NOT i MOD 3>
>                       fizz
>               <cfelse>
>                       #i#
>               </cfif>
>               <br>
>       </cfloop>
</cfoutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271261
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to