Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default Write a FizzBuzz program in a language of your choice in under 4 minutes

    Loop from 1 to 100,

    If the number is divisible by 3, it must print fizz.
    If the number is divisible by 5, it must print buzz.
    If the number is divisible by both 3 and 5 it must print fizzbuzz.

    If divisible by neither, neither fizz or buzz should be printed.


    Just a small something to waste some time.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  2. #2
    Join Date
    Nov 2006
    Location
    Narrich
    Posts
    5,687
    Tokens
    0
    Habbo
    Jamesy...

    Latest Awards:

    Default

    PHP Code:
    <?php
        $Count 
    1;
        while (
    $Count 101
        {
            echo 
    $Count;
            
            if (
    $Count == 0)
            {
                echo  
    " fizz";    
            }
            
            if (
    $Count == 0)
            {
                echo 
    " buzz";    
            }

            echo 
    "<br />";    

            
    $Count++;
        }
    ?>
    There are probably nicer ways of doing it I guess.
    Ex-janitor. Might pop in from time to time, otherwise you can grab all my information from http://jamesy.me.uk/

  3. #3
    Join Date
    Jan 2005
    Posts
    923
    Tokens
    1,112
    Habbo
    Jaiisun

    Latest Awards:

    Default

    used turbo delphi:

    Code:
    var
      count : integer;
    begin
      count := 1;
      repeat
        if count mod 3 = 0 then write ('fizz');
        if count mod 5 = 0 then write ('buzz');
        writeln;
        count := count + 1;
      until count = 101;
    readln;
    end.
    Former:
    Help Desk Manager | HabboxLive Staff | Events Organiser | Articles Staff | Productions Staff | Forum Moderator



  4. #4
    Join Date
    Jul 2006
    Location
    Cambridge, UK
    Posts
    447
    Tokens
    0

    Latest Awards:

    Default

    Written in Python:

    Code:
    for number in range(1,101):
    
        if number % 3 == 0:
            if number % 5 == 0:
                print(str(number)+" : fizzbuzz")
            else:
                print(str(number)+" : fizz")
    
        elif number % 5 == 0:
            if number % 3 == 0:
                print(str(number)+" : fizzbuzz")
            else:
                print(str(number)+" : buzz")
            
        else:
            print(str(number)+" : --")
    Which outputs (first 15):

    1 : --
    2 : --
    3 : fizz
    4 : --
    5 : buzz
    6 : fizz
    7 : --
    8 : --
    9 : fizz
    10 : buzz
    11 : --
    12 : fizz
    13 : --
    14 : --
    15 : fizzbuzz

  5. #5
    Join Date
    Nov 2008
    Location
    Cambridge, UK
    Posts
    901
    Tokens
    100

    Default

    Actionscript 3, messy but whatever

    Code:
    package  
    {
    	public class Application
    	{
    		
    		public function Application() 
    		{
    			for (var i:int = 1; i <= 100; i++)
    			{
    				trace(i);
    				if (i % 3 == 0)
    				{
    					trace("FIZZ");
    				}
    				if (i % 5 == 0)
    				{
    					trace("BUZZ");
    				}
    				
    				trace("--");
    			}
    		}
    		
    	}
    
    }
    we're smiling but we're close to tears, even after all these years

  6. #6
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Jamesy View Post
    PHP Code:
    <?php
        $Count 
    1;
        while (
    $Count 101
        {
            echo 
    $Count;
            
            if (
    $Count == 0)
            {
                echo  
    " fizz";    
            }
            
            if (
    $Count == 0)
            {
                echo 
    " buzz";    
            }

            echo 
    "<br />";    

            
    $Count++;
        }
    ?>
    There are probably nicer ways of doing it I guess.
    Hahaha, I wrote this yesterday before posting the thread, eerily similar:
    PHP Code:
    <?php
    for( $i 1$i <= 100$i++ )
    {
        echo 
    $i ' - ';
        if( 
    $i == ) { echo 'Fizz'; }
        if( 
    $i == ) { echo 'Buzz'; }
        echo 
    '<br />';
    }
    ?>


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  7. #7
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Just another way of doing it in PHP

    PHP Code:
    for( $i 1$i <= 100$i++ ) {

        echo 
    $i' - ', ( ( $i === ) ? 'Fizz' '' ), ( ( $i === ) ? 'Buzz' '' ), '<br />';



  8. #8
    Join Date
    Nov 2006
    Location
    Narrich
    Posts
    5,687
    Tokens
    0
    Habbo
    Jamesy...

    Latest Awards:

    Default

    It's getting smaller and smaller haha!
    Ex-janitor. Might pop in from time to time, otherwise you can grab all my information from http://jamesy.me.uk/

  9. #9
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php fizzbuzzgame(1-10035.print) ?>
    ---------- Post added 02-07-2010 at 09:08 PM ----------

    I tried yesterday, took me 10 minutes to get down 2 lines of ********. My PHP is not great.

    Last edited by Martin; 04-07-2010 at 12:39 PM.

  10. #10
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    And there is some big ass silence... mine, of course, was a joke. Anybody else got any other languages they can do this in? Javascript?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •