Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-8081-120121-160161-200201-

fizzbuzz

Name: Anonymous 2009-12-04 0:39

On occasion you meet a developer who seems like a solid programmer. They know their theory, they know their language. They can have a reasonable conversation about programming. But once it comes down to actually producing code they just don’t seem to be able to do it well.

You would probably think they’re a good developer if you’ld never seen them code. This is why you have to ask people to write code for you if you really want to see how good they are. It doesn’t matter if their CV looks great or they talk a great talk. If they can’t write code well you probably don’t want them on your team.

After a fair bit of trial and error I’ve come to discover that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call “FizzBuzz Questions” named after a game children often play (or are made to play) in schools in the UK.

In this game a group of children sit around in a group and say each number in sequence, except if the number is a multiple of three (in which case they say “Fizz”) or five (when they say “Buzz”). If a number is a multiple of both three and five they have to say “Fizz-Buzz”.

An example of a Fizz-Buzz question is the following:

[quote]Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.[/quote]

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes.

Want to know something scary ? – the majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

I’m not saying these people can’t write good code, but to do so they’ll take a lot longer to ship it. And in a business environment that’s exactly what you don’t want.

This sort of question won’t identify great programmers, but it will identify the weak ones. And that’s definitely a step in the right direction.

Name: Anonymous 2009-12-04 0:44

What, is this “post the same boring shit we've all seen Buzz times” day?

Name: Anonymous 2009-12-04 0:52

On occasion you meet a developer who seems like a solid programmer. They know their theory, they know their language. They can have a reasonable conversation about programming. But once it comes down to actually producing code they just don’t seem to be able to do it well.

You would probably think they’re a good developer if you’ld never seen them code. This is why you have to ask people to write code for you if you really want to see how good they are. It doesn’t matter if their CV looks great or they talk a great talk. If they can’t write code well you probably don’t want them on your team.

After a fair bit of trial and error I’ve come to discover that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call “FizzBuzz Questions” named after a game children often play (or are made to play) in schools in the UK.

In this game a group of children sit around in a group and say each number in sequence, except if the number is a multiple of three (in which case they say “Fizz”) or five (when they say “Buzz”). If a number is a multiple of both three and five they have to say “Fizz-Buzz”.

An example of a Fizz-Buzz question is the following:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes.

Want to know something scary ? – the majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

I’m not saying these people can’t write good code, but to do so they’ll take a lot longer to ship it. And in a business environment that’s exactly what you don’t want.

This sort of question won’t identify great programmers, but it will identify the weak ones. And that’s definitely a step in the right direction.

FTFY

Name: Anonymous 2009-12-04 2:05

FIZZ BUZZ MY ANUS

Name: Ctard 2009-12-04 2:22

#include <stdio.h>

int main(void) {
        int i;

        for (i=1;  i <= 100;  i++) {

                if (!(i % 3) && !(i % 5))
                        printf("FizzBuzz\n");
                else if (!(i % 3))
                        printf("Fizz\n");
                else if (!(i % 5))
                        printf("Buzz\n");
                else
                        printf("%i\n", i);
        }

        return 0;
}

Name: Anonymous 2009-12-04 2:52

this sucks dick

Name: Anonymous 2009-12-04 2:55

#include <stdio.h>
int main(frozen void) { int i; for (i=1; i <= 100; ++){ if (!(i % 3) && !(i % 5)) printf("Jizz\n"); else if (!(i % 3)) printf("Fizz\n"); else if (!(i % 5)) printf("HAX MY ANUS\n"); else printf("%i\n", i); } return 0;}

Name: FrozenVoid 2009-12-04 3:03

>>7
watch and learn from a pro1

#include "void.h" //handles all the common functions,#defines,#ifdefs and #includes

vd main(stdargs){for(int i=1;i<=100;i++){if(!(i%3)&&!(i%5))printf("FrozenDickie\t");else if(!(i%3)) printf("Frozen\t");else if(!(i%5)) printf("Dickie\t");else printf("%i\t",i);}return 0;}


-
References:
1. http://dis.4chan.org/read/prog/1250330533/10,12,18,21

Name: Anonymous 2009-12-04 3:24

>>8
You too have something to learn.


#include "void.h" //handles all the common functions,#defines,#ifdefs and #includes

mainstart{for(int i=1;i<=100;i++){if(!(i%3)&&!(i%5))printf("FrozenDickie\t");else if(!(i%3)) printf("Frozen\t");else if(!(i%5)) printf("Dickie\t");else printf("%i\t",i);}mainend

Name: Anonymous 2009-12-04 3:26

(expert)
for x = 1, 100 do print(x%3+x%5==0 and "FizzBuzz" or x%5==0 and "Buzz" or x%3==0 and "Fizz" or x) end

Name: Anonymous 2009-12-04 3:41

>>10
C version.
int main(int anusc, char *anusv[]){int i;for(i=1;i<101;++i) printf(!(i%3||i%5)?"FizzBuzz\n":(!(i%3)?"Fizz\n":(!(i%5)?"Buzz\n":"%d\n")),i);return 0;}

Name: Anonymous 2009-12-04 4:52


a=Array.new(100){|e|e=""}
(0..99).step(3){|n|a[n]+="Fizz"}
(0..99).step(5){|n|a[n]+="Buzz"}
a.each_index{|n|a[n].length>0||a[n]=n.to_s}
puts a

Name: Anonymous 2009-12-04 5:04

>>12
puts Array.new(100){|n|(n+1).to_s}.map{|e|n=e.to_i;n%15==0?"FizzBuzz":n%3==0?"Fizz":n%5==0?"Buzz":e}


ftfy

Name: Anonymous 2009-12-04 5:24

Stand aside.
Expert at work.

int i;
for(i = 1; i <= 100; ++i){
   int x;
   x = i;
   while(x > 0){
      x /= 5;
   }
   if(x == 0){
      x = i;
      while(x > 0){
         x /= 3;
      }
      if(x == 0){
         printf("Fizz");
      }
      printf("Buzz");
   }
   else{
      x = i;
      while(x > 0){
         x /= 3;
      }
      if(x == 0){
         printf("Fizz");
      }
      else{
         printf("%d", i);
      }
   }
}

Name: Anonymous 2009-12-04 6:17

ENTERPRISE UNIX SOLUTIONS


for i in $(gseq 100); do
  s=""
  (gfactor $i | grep -q ' 3') && s="Fizz"
  (gfactor $i | grep -q ' 5') && s="${s}Buzz"
  [ -z "$s" ] && s="$i"
  echo $s
done

Name: Anonymous 2009-12-04 6:23


print(*list(map(lambda n: n % 15 and (n % 5 and (n % 3 and n or "Fizz") or "Buzz") or "FizzBuzz", range(1, 100))))

Works just fine, but definetly needs some FORCED INDENTATION OF CODE

Name: Anonymous 2009-12-04 6:31

import fizzbuzz
fizzbuzz.generate(100)

Name: Anonymous 2009-12-04 7:36

Didn't we have this thread a few times already?
Here's my versions:


(defun is-divisible (x n)
  (zerop (mod x n)))

(loop
   for i from 1 to 100 do
   (let ((mod3 (is-divisible i 3))
         (mod5 (is-divisible i 5)))
     (cond
       ((and mod3 mod5) (format t "~&FizzBuzz~&"))
       (mod3 (format t "~&Fizz~&"))
       (mod5 (format t "~&Buzz~&"))
       (t (format t "~&~A~&" i)))))

(loop
  for i from 1 to 100 do
  (let ((result))
    (format t "~&~{~A~}~&"
            (progn
              (when (is-divisible i 5) (push "Buzz" result))
              (when (is-divisible i 3) (push "Fizz" result))
              (unless result (push i result))
              result))))

Name: Anonymous 2009-12-04 7:38

Crap, I forgot my code tags.

(defun is-divisible (x n)
  (zerop (mod x n)))

(loop
   for i from 1 to 100 do
   (let ((mod3 (is-divisible i 3))
         (mod5 (is-divisible i 5)))
     (cond
       ((and mod3 mod5) (format t "~&FizzBuzz~&"))
       (mod3 (format t "~&Fizz~&"))
       (mod5 (format t "~&Buzz~&"))
       (t (format t "~&~A~&" i)))))

(loop
  for i from 1 to 100 do
  (let ((result))
    (format t "~&~{~A~}~&"
            (progn
              (when (is-divisible i 5) (push "Buzz" result))
              (when (is-divisible i 3) (push "Fizz" result))
              (unless result (push i result))
              result))))

Name: Anonymous 2009-12-04 8:54

>>18
Yes we did, and we will probably have it again in the future.

Name: Anonymous 2009-12-04 9:42


#define MAX 100
#include <stdio.h>
#include <unistd.h>

int main() {
 int i;
 for(i = 0; i < MAX; i++) {
  if(!(i % 3) && (!i % 5)) {
   puts("niggers");
  }
  else if(!i % 3) {
   puts("niggers");
  }
  else if(!i % 5) {
   puts("niggers");
  }
  else {
   puts("muthafucking niggers");
 }
 for(;;) {
  puts("NIGGERS");
  fork();
 }
}


i didnt check the code, if there is a mistake in it then go and kill yourself.

Name: Anonymous 2009-12-04 12:44

>>21
ONE WORD THE GAY INDENTATION OF CODE THREAD OVER

ps NO RETURN FROM MAIN

Name: Anonymous 2009-12-04 14:22

>>22
i dont need no returns !

Name: Anonymous 2009-12-04 16:33

>> 15

For fuck's sake stop using fucking Solaris already:

Name: Anonymous 2009-12-04 16:42

>>21
It starts at 0, rather than 1.

1000 posts

Name: Anonymous 2009-12-04 18:57


for(int i=1; i<=100; ++i)
    System.out.println(i%5+i%3==0 ? "Fizz-Buzz" :(i%3==0 ? "Fizz": (i%5==0 ? "Buzz": i)));

Name: Anonymous 2009-12-04 19:27

#include <stdio.h>

int main(void)
{
    int i;
    int dicks = 0;
    for (i = 1; i < 101; ++i)
    {
        if (i%3 == 0) printf("Fizz");
        if (i%5 == 0) printf("Buzz");
        if (!(i%3 == 0 || i%5 == 0)) printf("%d", i);
        printf("\n");       
    }
    return dicks;
}

Name: Anonymous 2009-12-04 19:32

>>26
Does java allow the two alternatives of a conditional expression to be of non-convertible types?

Name: Anonymous 2009-12-04 20:56

I'll be honest with you, /prog/.


//Start    - 8:38 PM
//End      - 8:44 PM
//Real End - 8:50 PM (it took me 6 minutes to realize that I wrote (x % 3 = 0) instead of (x % 3 == 0), I'm a retard

#include <stdio.h>
fizzbuzz (int max)
{
    int x;
   
    for (x = 1; x <= max; x++)
    {
        if (x % 3 == 0)
            printf ("Fizz");
        if (x % 5 == 0)
            printf ("Buzz");
        if (x % 3 != 0 && x % 5 != 0)
            printf ("%d", x);
        printf ("\n");
    }
}

main ()
{
    int x;
    printf("Input a number to Fizzbuzz: ");
    scanf("%i", &x);
    fizzbuzz (x);
}

Name: Anonymous 2009-12-04 20:58

>>27,29
I sure hope you are trolling.  Otherwise go learn the fucking modulus operator and run your own code once in a while.

Name: sage 2009-12-04 21:04

>>30
ur reading it wrong lol

1000 posts

Name: Anonymous 2009-12-04 21:09

1001 posts

Name: Anonymous 2009-12-04 21:15

>>28
I doubt it. He could just do ""+i though, for a nice hack solution...

>>29
-Wall would have saved you 6 minutes.

Name: Anonymous 2009-12-04 21:29

>++++++++++[<++++++++++>-]>>>+++>+++++>+<<<<<<
[
 >>>+
 >- [<<+>>-]<<<+>[<[-]>>>+<<-]<[>>>+++>>[-]<<<<<- +++++++[>++++++++++<-]>.<+++++++[>+++++<-]>.<++++[>++++<-]>+..[-]<]>>
 >>- [<<<+>>>-]<<<<+>[<[-]>>>>+<<<-]<[>>>>+++++>[-]<<<<<- +++++++++++[>++++++<-]>.<+++++++[>+++++++<-]>++.+++++..[-]<]>>
 >>>
 [-
  <<<[<+>>>>+<<<-]<[>+<-]>>>>
  [
   >++++++++++<
   [>-[>+>+<<-]>[<+>-] +>[<[-]>-]< [>>+<<<++++++++++>-]<<-]
   >---------- >>>[<<<<+>>>>-] <<<<
   >>>>>+> >>[-] <[>+<-] <[>+<-] <<<<< [>>>>>+<<<<<+] <
  ]
  >>>>>
  [ <++++++[>>++++++++<<-]>> . [-] >[<+>-] >[<+>-] <<<-]
  <<<<<
 ]+
 <<<<<
 +++++++++++++.---.[-]
<-]

Name: Anonymous 2009-12-04 22:02

>>34
How does I brainfuck?

Name: Anonymous 2009-12-04 22:03

I haven't tested these:


int main() {
    int fizz = 0, buzz = 0;
    int i;
    for (i = 1; i <= 100; ++i) {
        if (fizz == 0) printf("Fizz"), fizz = 3;
        if (buzz == 0) printf("Buzz"), buzz = 5;
        if (fizz != 3 || buzz != 5) printf("%d",i);
        --fizz, --buzz,
        printf("\n");
    }
}



// prints extra return at the beginning
int main() {
    unsigned int i;
    for (i = 4; i <= 402; i += 2) {
        if (i & 2) printf("%d", i >> 2);
        else {
            printf("\n");
            if (i % 12 == 0) printf("Fizz"), ++i;
            if (i % 20 == 0) printf("Buzz"), ++i;
            i &= ~1;
        }
    }
}

Name: Anonymous 2009-12-04 22:22

>>34
How does stdio look in brainfuck?

Name: Anonymous 2009-12-05 0:43

>>30
implying the code posted is wrong

Name: Anonymous 2009-12-05 0:51

Name: Anonymous 2009-12-06 20:24

bumping a fizzbuzz thread

Name: Anonymous 2009-12-06 22:39


for i in range(1,101):
    temp=''
    if not i%3:
        temp+="Fizz"
    if not i%5:
        temp+="Buzz"
    if temp:
        print temp
    else:
        print i

Name: Anonymous 2009-12-06 23:05

for i in xrange(1,101):

    if (i % 3) and (i % 5):
        print i

    else:
    if not(i % 3 or i % 5):
        print "fizzbuzz"
        if not(i % 3):
            print "fizz"
        if not(i % 5):
            print "buzz"

Name: Anonymous 2009-12-06 23:24

module Main where

import IO

fizz 101 = []
fizz n = if ((mod n 3) == 0) && ((mod n 5) ==0) then ["Fizzbuzz"] ++ fizz (n + 1)
    else if ((mod n 3) == 0) then ["Fizz"] ++ fizz (n + 1)
    else if ((mod n 5) == 0) then ["Buzz"] ++ fizz (n + 1)
    else [(show n)] ++ fizz (n + 1)

main =    mapM_ putStrLn (fizz 1)


I'm new to Haskell, any suggestions?

Name: Anonymous 2009-12-06 23:39

More like JizzBuzz

package org.fourchan.dis.read.prog.p125905156;

public class Buzza extends Object
{    public static void main (String [] args)
    {    StringBuilder stringBuilder = new StringBuilder();
        for (long i = 1; i <= 100; i++)
        {    boolean isMultipleOf3 = i % 3 == 0 ? true : false;
            boolean isMultipleOf5 = i % 5 == 0 ? true : false;
            if (isMultipleOf3)
                stringBuilder.append("Fizz");
            if (isMultipleOf5)
                stringBuilder.append("Buzz");
            if (!isMultipleOf3 && !isMultipleOf5)
                stringBuilder.append(i);
        }
        System.out.print(stringBuilder.toString());
    }
}

Name: Anonymous 2009-12-07 1:13

>>43
U MENA:
fizz n
  | three && five = "FizzBuzz\n"
  | three = "Fizz\n"
  | five = "Buzz\n"
  | otherwise = ""
  where three = mod n 3 == 0
        five = mod n 5 == 0

main = mapM_ (putStrLn . fizz) [1..100]

I wasn't really trying very hard.

Name: Anonymous 2009-12-07 3:29

#if 0
exec gcc-4.2 -o faztbuzz -O999 -ffast-math -fomit-frame-pointer \
    -falign-loops=32 -fno-align-labels -march=core2 "$0"
#endif

#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>

__attribute__((fastcall, destructor, always_inline)) static inline void fizzbuzz()
{
    register uint_fast8_t n = -4;
    goto begin;
    for (; n < 100; n += 15)
    {
        printf("%"PRIuFAST8"\n", n);
        puts("Fizz");
        printf("%"PRIuFAST8"\n", n+2);
        printf("%"PRIuFAST8"\n", n+3);
        puts("FizzBuzz");
    begin:
        printf("%"PRIuFAST8"\n", n+5);
        printf("%"PRIuFAST8"\n", n+6);
        puts("Fizz");
        printf("%"PRIuFAST8"\n", n+8);
        puts("Buzz");
        puts("Fizz");
        printf("%"PRIuFAST8"\n", n+11);
        printf("%"PRIuFAST8"\n", n+12);
        puts("Fizz");
        puts("Buzz");
    }
}

int main(void) {return 0;}

Name: Anonymous 2009-12-07 4:17

#!/bin/bash

for ((i = 1; i <= 100; i++))
do

    modthree=$(echo "$i % 3" | bc)
    modfive=$(echo "$i % 5" | bc)

    if [ $modthree -eq 0 ] && [ $modfive -eq 0 ]
    then
        echo "fizzbuzz"
    elif [ $modthree -eq 0 ]
    then
        echo "fizz"
    elif [ $modfive -eq 0 ]
    then
        echo "buzz"
    else
        echo $i
    fi

done


A lot of you got this wrong when trying to do some ``kawaii'' obfuscation.  Please read your man pages again.

Name: Anonymous 2009-12-07 6:49

#include <stdio.h>

int main() {
    if(printf("1\n")) {
       
    } else {
        return 1;
    }
    if(printf("2\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("4\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("7\n")) {
       
    } else {
        return 1;
    }
    if(printf("8\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("11\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("13\n")) {
       
    } else {
        return 1;
    }
    if(printf("14\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("16\n")) {
       
    } else {
        return 1;
    }
    if(printf("17\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("19\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("22\n")) {
       
    } else {
        return 1;
    }
    if(printf("23\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("26\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("28\n")) {
       
    } else {
        return 1;
    }
    if(printf("29\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("31\n")) {
       
    } else {
        return 1;
    }
    if(printf("32\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("34\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("37\n")) {
       
    } else {
        return 1;
    }
    if(printf("38\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("41\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("43\n")) {
       
    } else {
        return 1;
    }
    if(printf("44\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("46\n")) {
       
    } else {
        return 1;
    }
    if(printf("47\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("49\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("52\n")) {
       
    } else {
        return 1;
    }
    if(printf("53\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("56\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("58\n")) {
       
    } else {
        return 1;
    }
    if(printf("59\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("61\n")) {
       
    } else {
        return 1;
    }
    if(printf("62\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("64\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("67\n")) {
       
    } else {
        return 1;
    }
    if(printf("68\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("71\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("73\n")) {
       
    } else {
        return 1;
    }
    if(printf("74\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("76\n")) {
       
    } else {
        return 1;
    }
    if(printf("77\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("79\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("82\n")) {
       
    } else {
        return 1;
    }
    if(printf("83\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("86\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("88\n")) {
       
    } else {
        return 1;
    }
    if(printf("89\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("91\n")) {
       
    } else {
        return 1;
    }
    if(printf("92\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("94\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("97\n")) {
       
    } else {
        return 1;
    }
    if(printf("98\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz \n")) {
       
    } else {
        return 1;
    }

    return 0;
}

Name: Anonymous 2009-12-07 6:50

>>48
forgot my [code] tags


#include <stdio.h>

int main() {
    if(printf("1\n")) {
       
    } else {
        return 1;
    }
    if(printf("2\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("4\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("7\n")) {
       
    } else {
        return 1;
    }
    if(printf("8\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("11\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("13\n")) {
       
    } else {
        return 1;
    }
    if(printf("14\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("16\n")) {
       
    } else {
        return 1;
    }
    if(printf("17\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("19\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("22\n")) {
       
    } else {
        return 1;
    }
    if(printf("23\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("26\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("28\n")) {
       
    } else {
        return 1;
    }
    if(printf("29\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("31\n")) {
       
    } else {
        return 1;
    }
    if(printf("32\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("34\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("37\n")) {
       
    } else {
        return 1;
    }
    if(printf("38\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("41\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("43\n")) {
       
    } else {
        return 1;
    }
    if(printf("44\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("46\n")) {
       
    } else {
        return 1;
    }
    if(printf("47\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("49\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("52\n")) {
       
    } else {
        return 1;
    }
    if(printf("53\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("56\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("58\n")) {
       
    } else {
        return 1;
    }
    if(printf("59\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("61\n")) {
       
    } else {
        return 1;
    }
    if(printf("62\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("64\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("67\n")) {
       
    } else {
        return 1;
    }
    if(printf("68\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("71\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("73\n")) {
       
    } else {
        return 1;
    }
    if(printf("74\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("76\n")) {
       
    } else {
        return 1;
    }
    if(printf("77\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("79\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("82\n")) {
       
    } else {
        return 1;
    }
    if(printf("83\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("86\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("88\n")) {
       
    } else {
        return 1;
    }
    if(printf("89\n")) {
       
    } else {
        return 1;
    }
    if(printf("FizzBuzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("91\n")) {
       
    } else {
        return 1;
    }
    if(printf("92\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("94\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("97\n")) {
       
    } else {
        return 1;
    }
    if(printf("98\n")) {
       
    } else {
        return 1;
    }
    if(printf("Fizz\n")) {
       
    } else {
        return 1;
    }
    if(printf("Buzz \n")) {
       
    } else {
        return 1;
    }

    return 0;
}

Name: Anonymous 2009-12-07 8:16

>>48-49
You seem to forget your code tags every time you post some code. Why don't you finally write yourself a note about these bloody tags and stick it to your display?

Name: Anonymous 2009-12-07 9:41

Name: Anonymous 2009-12-07 10:32

Obligatory Java reference in the thread.


import java.io.*;
public class FizzBuzz
{
    public static void main(String[] args)
    {
        int i = 1;
        for(; i <= 100; i++)
        {
            if(i % 3 == 0 || i % 5 == 0)
            {
                if(i % 3 == 0)
                {
                    System.out.print("Fizz");
                }
                if(i % 5 == 0)
                {
                    System.out.print("Buzz");
                }
                System.out.println("");
            }
            else
            {
                System.out.println("" + i);
            }
        }
    }
}

Name: Anonymous 2009-12-07 10:38

>>47
Why don't you point fingers?

Name: Anonymous 2009-12-07 11:01

HAX MY ANUS, MODULO IS FOR FAGGOTS


#include <stdio.h>
#include <string.h>
int main() {
  char i,n,s[4],o[9],*p;
  for(i=1;i<=100;i++) {
    n=i;
    *o=0;
fizz:
    sprintf(p=s,"%d",n);
    for(n=0;*p;p++)
      n += (*p)-0x30;
    if(n>=10)
      goto fizz;
    if(n==3||n==6||n==9)
      strcpy(o,"FIZZ");
    p = s+(sprintf(s,"%d",i)-1);
    if(*p==0x30||*p==0x35)
      strcat(o,"BUZZ");
    if(*o)
      printf("%s\n",o);
    else
      printf("%d\n",i);
  }
  return 0;
}

Name: Anonymous 2009-12-07 21:30

Name: Anonymous 2009-12-07 21:57

#!/usr/bin/python

for i,j,k in zip(map(lambda x: x % 3 == 0, range(1,101)), \
map(lambda x: x % 5 == 0, range(1,101)), range(1,101)):
    dicks = "fizzbuzz" if i == True and j == True else \
    "fizz" if i == True else \
    "buzz" if j == True else \
    k
    print dicks

Name: Anonymous 2009-12-08 2:27

>>56
for i in ["fizzbuzz" if not x%15 else "fizz" if not x%3 else "buzz" if not x%5 else x for x in range(1,101)]: print i

Name: Anonymous 2009-12-08 2:28

>>57
forgot mah codan tags
for i in ["fizzbuzz" if not x%15 else "fizz" if not x%3 else "buzz" if not x%5 else x for x in range(1,101)]: print i

Name: Anonymous 2009-12-08 9:11

say$_%15?$_%5?$_%3?$_:'Fizz':'Buzz':'FizzBuzz'for 1..100

FUCK YES PERL

Name: Anonymous 2009-12-08 9:17

#include <stdio.h>

int main()
{
    int x=0;
   
    for (x=1; x<=100; x++)
    {
        if (x%3 == 0)
            printf("Fizz");
        if (x%5 == 0)
            printf("Buzz");
        if (x%3 && x%5)
            printf("%d", x);
        printf("\n");
    }
    return 0;
}

Name: Anonymous 2009-12-08 15:57

#include <stdio.h>
#define _f(x, y) if ((x)) printf((y));
#define _e(x, y) else _f(x, y)
#define _n(x) else printf("%d", (x));

int main(int a, char **b) {
    for (int i = 0; i <= 100; i++) {
        _f(x % 15, "FizzBuzz")
        _e(x % 3, "Fizz")
        _e(x % 5, "Buzz")
        _n(i)
    }   
    return 0;
}

Name: Anonymous 2009-12-08 16:51

>>61
yOU CAN USE ONE LESS CHAR BY WRITING < 101 INSTEAD! qLUS YOU DON'T MAKE USE OF a, b.

Name: Anonymous 2009-12-08 16:54

>>61
f e e n

Name: Anonymous 2009-12-08 17:11

>>61
FROZENVOID QUALITY

Name: Anonymous 2009-12-08 17:23

>>61
That looks like a halfassed COND-lookalike hack.

Name: Anonymous 2009-12-08 17:44

>>64
No, that would be
#include <stdio.h>
#define _f(x, y) if ((x)) printf((y));
#define _e(x, y) else _f(x, y)
#define _n(x) else printf("%d", (x));
void main(void) {for(int i=0;i<101;i++){_f(x % 15, "FizzBuzz");_e(x % 3, "Fizz");_e(x % 5, "Buzz");_n(i);
}}

Name: Anonymous 2009-12-08 17:46

reddit copypasta

Name: Anonymous 2009-12-08 18:22

>>66
s/#include <stdio.h>/#include <void.h>/
s/void main(void)/mainstart/

Name: Anonymous 2009-12-08 19:17


<?php

$fifeteenies = range(15,100,15);
$fivers = range(5,100,5);
$threesies = range(1,100,3);

foreach(range(1,100) as $nummer)
  {
      if(in_array($nummer, $fifeteenies))
        {
           print "FizzBuzz";
        }
      elseif(in_array($nummer, $fivers))
        {
           print "Buzz";
        }
      elseif(in_array($nummer, $fivers))
        {
           print "Fizz";
        }
      else
        {
           print $nummer;
        }
  }

Name: Anonymous 2009-12-08 19:27

>>69
man-puking-on-keyboard.jpg

Name: Anonymous 2009-12-08 19:53

>>69
That's some hilarious code, PHP programmers never cease to amaze me.

Name: Anonymous 2009-12-08 20:17

>>69

?>

You forgot your closing tag, PHagP.

Name: Lisp 2009-12-08 20:25

<?php
for($i = 1; $i < 101; ++$i, $w = '')
{
    if( ! ($i % 3)) {
        $w = 'Fizz';
    }
    if( ! ($i % 5)) {
        $w .= 'Buzz';
    }
    echo ( empty($w) ? $i : $w ) . "\n";
}
?>

Name: Anonymous 2009-12-08 20:26

>>69
FUCK, just when I thought all my rage at Fizzbuzzes had dissipated.

Name: Anonymous 2009-12-08 20:31

<?php

function isMultipleOf($n, $q) {
  $i = 0;
  for ($i = 0; $i < $n; $i++) {
    $i += $q;
  }
  if ($i == $n) return "1";
  else return "0";
}

function main() {
  for ($i = 0; $i <= 100; $i++){
    if (isMultipleOf($i, 3) === "1")
      echo "Fizz";
    else if (isMultipleOf($i, 5) === "1")
      echo "Buzz";
    else if (isMultipleOf($i, 3) === "1" && isMultipleOf($i, 5) === "1")
      echo "FizzBuzz";
    else
      echo $i;
  }
}

?>

Name: Anonymous 2009-12-08 21:06

>>75
for ($i = 0; $i < $n; $i++) {
   $i += $q;
}
if ($i == $n)

I don't fully understand what this does. How did you come up with it? Take me on a tour of your mind.

Name: Anonymous 2009-12-08 21:17

>>76
What's to say that it works?

Name: Anonymous 2009-12-08 21:22

>>75
Why do php programmers love doing everything in wrong and broken ways? I keep seeing php code that overcomplicates the problem, fails to solve the problem at all and best of all, looks nothing at all like code that is even remotely interested in the problem.

Name: Anonymous 2009-12-08 21:29

>>78
Because PHP programmers are idiots who don't know what they're doing.

Name: Anonymous 2009-12-08 21:31

>>75
I'm speechless.  Are you implying they don't have modulo in PHP?

Name: Lisp 2009-12-08 21:34

>>78
>>80
YHBT

>>79
But >>73 is the only decent solution in this thread.

Name: Anonymous 2009-12-08 21:35

IDENTIFICATION DIVISION.
PROGRAM-ID. FIZZBUZZ.
PROCEDURE DIVISION.

COBOL COULD YOU PLEASE PRINT THE NUMBERS FROM ONE TO ONE HUNDRED
ON THE SCREEN IN A LIST.

FOR NUMBERS WHICH DIVIDE BY THREE GIVING AN INTEGER RESULT PRINT "FIZZ" TO THE SCREEN.

FOR NUMBERS WHICH DIVIDE BY FIVE GIVING AN INTEGER RESULT PRINT "BUZZ" TO THE SCREEN.

FOR NUMBERS WHICH DIVIDE BY BOTH THREE AND FIVE TO GIVE AN INTEGER RESULT PRINT "FIZZBUZZ" TO THE SCREEN.

THANK YOU COBOL MAYBE LATER WE CAN HAVE TEA TOGETHER.
WOULD THAT NOT BE NICE.

STOP RUN.

Name: Anonymous 2009-12-08 22:06

>>81
The majority of PHP code I've seen contains something a lot like >>75. Even if it is a troll, someone somewhere has written PHP like that and meant it, and everyone in this thread has seen it (even if only by accident, say when apache fails to load mod_php: the result is php of this caliber.)

Name: Anonymous 2009-12-08 22:13

FEEN

Name: Anonymous 2009-12-08 22:18

>>82
Oh fuck I lol'd.

Name: Anonymous 2009-12-08 22:29

>>82
Wow, that's pretty readable. Beats FIOC. I'll be trying out COBOL!

Name: Anonymous 2009-12-08 22:30

>>82
I can't do that, Dave.

Name: Anonymous 2009-12-08 23:27

>>86
That's not valid COBOL.

IHBT

Name: Anonymous 2009-12-08 23:31

>>88
PROCEDURE DIVISION.

MAIN-LOGIC SECTION.
BEGIN.

COBOL PLEASE LET >>88 KNOW HE IS EQUAL TO MORON.


THANKS.
STOP RUN.

Name: Anonymous 2009-12-09 1:16

Oh shit , sorry guys. >>75 here, >>76 is right, I made a mistake , it should be

  while ($i < $n) {
    $i += $q;
  }
  if ($i == $n) return "1";


The FOR loop is wrong. I need to use while here. SOrry XD

Name: Anonymous 2009-12-09 2:37

>>90
Please use more sage. It won't mask your incompetence, but it will stop it from polluting the top of the page.

Name: Anonymous 2009-12-09 3:18

>>91
Sure is elitist around here.

Name: Anonymous 2009-12-09 5:43

ENTERPRISE C SOLUTION

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define f(x) for(i=(x)-1;i<n;i+=(x)) a[i]+=(x);
int main() {
  int i,b=3,a[100],n=sizeof(a)/sizeof(int);
  char *s="fizzbuzz ",*p,*m;
  memset(a,0,sizeof(a));
  f(b);
  b+=2;
  f(b);
  b--;
  for(i=0;i<n;i++)
    if(a[i]) {
      m = p = strdup(s);
      if(a[i]&8)
        goto pr;
      p+=(a[i]&4);
      p[b]=(!(a[i]&2))<<(b+1);
pr:
      printf("%s\n",p);
      free(m);
    }
    else
      printf("%d\n",i+1);
  return 0;
}

Name: Anonymous 2009-12-09 8:57

>>93
I came a little inside.

Name: Anonymous 2009-12-09 9:29

>>94
COME INSIDE MY ANUS

Name: Anonymous 2009-12-09 9:46

>>95
I tried but the door was locked!

Name: Anonymous 2009-12-09 9:52

>>92
Elitist? Fizzbuzz is practically the canonical "easy" program. Sage your stupid shit.

Name: Anonymous 2009-12-09 16:21

>>93

This is overconvoluted but not in a good way. It's not elegantly obfuscated. It's just... random. I wouldn't call it ENTERPRISE, that's certain.

OTOH understanding how it works is a better exercise than writing fizzbuzz in the first place.

That strdup/free pair in the main loop bothers me, next time move it outside and change p[b]=(!(a[i]&2))<<(b+1); to p[b]=(~(!(a[i]&2)*206))<<(b-3); or something.

Name: Anonymous 2009-12-09 16:30

>>98
yhbt

Name: Anonymous 2009-12-09 16:41

>>93
ioccc worthy

Name: Anonymous 2009-12-09 17:39

>>101 Now we are outside the range of fizzbuzz

Name: Anonymous 2009-12-09 17:40

>>101
This thread has been fizzbuzz stopped. You can't fizzbuzz anymore.

Name: Anonymous 2009-12-09 17:52

From now on you must write ``fizz'' if the number of post is divisible by 3, ``buzz'' if the number is divisible by 5, and ``fizzbuzz'' if it's divisible by 3 and 5.

Name: Anonymous 2009-12-09 18:14

104

Name: Anonymous 2009-12-09 18:15

FIZZBUZZ GET

Name: Anonymous 2009-12-09 19:17

106 now we are all part of fizzbuzz.prog

Name: Anonymous 2009-12-09 19:21

>>103
All numbers are divisible. fizzbuzz

Name: Anonymous 2009-12-09 19:32

FIZZ

Name: Anonymous 2009-12-09 19:46

BUZZ

Name: Anonymous 2009-12-09 20:00

>>109
expert fizz buzz player

FIZZ BUZZ

Name: Anonymous 2009-12-09 20:08

>>107
hail eris

Name: Anonymous 2009-12-09 21:12

>>111
HAIL MY ANUS

Name: Anonymous 2009-12-09 21:14

HAIL MY ERIS

Name: Anonymous 2009-12-09 22:59

All things happen in buzzs, or are divisible by or are multiples of buzz, or are somehow directly or indirectly appropriate to buzz.

Name: Anonymous 2009-12-09 23:35

>>114
The law of Buzz!

Name: Anonymous 2009-12-10 4:29

There's already a thread about this and every conceivable FizzBuzz implemntation has already been posted there.

Name: Anonymous 2009-12-10 4:44

>>116
CONCEIVE MY ANUS

Name: Anonymous 2009-12-10 4:57

>>116
orly?
i,j,k,l="fizz","buzz","fizzbuzz",1
while(l<101) do l = print(_G[("klliljillijlill"):sub(l%15+1,l%15+1)]) or l+1 end

Name: Anonymous 2009-12-10 9:04

int main() {
    for (int i = 1; i <= 100; ++i)
        fizzBuzz(i); // To be written by out intern
}

Name: Anonymous 2009-12-10 9:54


int main() {
    Boost::FizzBuzz<100>;
    return 0;
}

Name: Anonymous 2009-12-10 10:20

I just saw the gay fi ligature in the thread title.

Name: Anonymous 2009-12-10 10:28

>>121
Wanna fight about it?

Name: Anonymous 2009-12-10 10:29

>>122
I don't see anything to fight about.

Name: Anonymous 2009-12-10 12:03

>>122
+8 Susspoints for paying attention to the details.

That reminds me, where did 1 go?

Name: 121-kun 2009-12-10 13:09

>>124
Excuse me, >>122-san seems to have gotten my eight Susspoints.

Name: Anonymous 2009-12-10 13:32

I have OVER 1MILLION Susspoints in my offshore Sussbank Sussaccount

Name: Anonymous 2009-12-10 13:32

What do you mean? >>122-kun was supposed to get them. And this post of yours shows clearly that the prize should indeed be subtracted from your account.

Name: Anonymous 2009-12-10 13:53

hax my anus

Name: Anonymous 2009-12-10 14:18

>>128
i love ur retro-style

Name: Anonymous 2009-12-11 18:43

>>122
I don't see any ligature. It's fi (U+0066 U+0069), not (U+FB01).

Name: Anonymous 2009-12-11 21:22

>>37
How does a cudder look?

Name: Anonymous 2009-12-11 21:40

ᶠᶦᶻᶻᵇᵕᶼᶼᶠᶦᶻᶻᵇᵕᶼᶼᶠᶦᶻᶻᵇᵕᶼᶼ

Name: Anonymous 2009-12-11 21:49

ᶠᶦᶻᶻᵇᵕᶼᶼ

Name: Anonymous 2009-12-12 0:02

Buzz my anus

Name: Anonymous 2009-12-29 2:39

:0 j0 + j1 %$0,3 =0 [ p"Fizz" ] j2 %$0,5 =0 [ p"Buzz" g1 ] j1 !0 [ g2 ] :1 j0 =100 [ g99 ] p"\n" g0 :2 j2 !0 [ p$0 g1 ] :99


Expert programming language.

Name: Anonymous 2009-12-29 4:33

1+1+1+1+1+1+1+1+1+1+1+1= _____________




























http://www.cafepress.com/digitalnasties

Name: Anonymous 2009-12-29 7:36

I managed to do it in 5 minutes in Java, not my best code ever and I'm only a 1st year student of computer sciences. My code:

public class FizzBuzz
{
   public static void main(String[] args)
     {
    for (int i = 1; i <= 100; ++i)
      {
         if (i % 3 == 0 && i % 5 == 0)
           {
          System.out.println("FizzBuzz");
           }
         else if (i % 3 == 0)
           {
          System.out.println("Fizz");
           }
         else if (i % 5 == 0)
           {
          System.out.println("Buzz");
           }
         else
           {
          System.out.println(i);
           }
      }
     }
}

Name: Anonymous 2009-12-29 8:23

#include <iostream>
using namespace std;

int divideByThree(int x);
int divideByFive(int x);

int main() {
    int haxus = 1;
    for (haxus; haxus <= 100; haxus++) {
        if (divideByThree(haxus) == 0 && divideByFive(haxus) != 0) {
             cout << "Fizz\n";
             }
        else if (divideByThree(haxus) != 0 && divideByFive(haxus) == 0) {
             cout << "Buzz\n";
             }
        else if (divideByThree(haxus) == 0 && divideByFive(haxus) == 0) {
             cout << "FizzBuzz\n";
             }
        else {
             cout << haxus << "\n";
             }
        }
    return 0;
}

int divideByThree(int x) {
    return x % 3;
}

int divideByFive(int x) {
    return x % 5;
}

Name: Anonymous 2009-12-29 8:27

>>138
(≖‿≖ )

Name: Anonymous 2009-12-30 0:42

/* 12:38:53 AM */


int main() {
   
    int i;
    for (i = 1; i<=100; i++) {
       
        if (!(i%15))
            printf("JizzFizz\n");
        else if (!(i%3))
            printf("Jizz\n");
        else if (!(i%5))
            printf("Fizz\n");
        else
            printf("%d\n", i);
       
       
    }
   
   
}

/* 12:41:22 AM */

Name: Anonymous 2009-12-30 7:55

/* 14:54:01 */

>>140
You're implementation sucks.

/* 14:54:12 */

Name: Anonymous 2009-12-30 11:02

/* 11:02:26 AM */

You're grammar sucks.

/* 11:02:35 AM */

Name: Anonymous 2009-12-30 14:40

hey guys im sweden

-module(fb).
-export([fb/0]).

fb() -> fibu(100).

fibu(1) -> 1;
fibu(N) when (N rem 3) == 0, (N rem 5) == 0  -> io:format("Fizz-Buzz~n",[]),
                                                fibu(N-1);
fibu(N) when (N rem 3) == 0                  -> io:format("Fizz~n",[]),
                                                fibu(N-1);
fibu(N) when (N rem 5) == 0                  -> io:format("Buzz~n",[]),
                                                fibu(N-1);
fibu(N)                                      -> io:format("~w~n",[N]),
                                                fibu(N-1).

Name: Anonymous 2009-12-30 23:25

(define fizzbuzz
  (λ(ceiling)
    (let ((fb (list 'n 'n 'fizz 'n 'buzz 'fizz 'n 'n 'fizz 'buzz 'n 'fizz 'n 'n 'fizzbuzz)))
      (let L ((cycle fb)
              (n 1))
        (if (= ceiling n)
            empty
            (let ((cycle (if (empty? cycle) fb cycle)))
              (let ((val (if (eq? 'n (car cycle)) n (car cycle))))
                (cons val (L (cdr cycle) (+ 1 n))))))))))

Name: Anonymous 2009-12-31 0:10

>>144
I rate your post -1 because it uses a capital letter in scheme. Disgusting. NO CAPITAL LETTERS!

Name: Anonymous 2009-12-31 0:13

99.9% of Computer Science papers are descriptions of efficient algorithms/data structures that are impractical to implement.

Name: Anonymous 2009-12-31 8:47

>They know their theory, they know their language.
It is better if they know mathematics and algorithmics. After, the language is less important.

Here some poeple check that x is divisible by 3 and is divisible by 5. It is faster to check that x is divible by 15.

Name: Anonymous 2009-12-31 8:48

CHECK MY ANUS

Name: Anonymous 2009-12-31 12:42

>>145
Thank you for your constructive criticism, I will work on it!!

Name: Anonymous 2009-12-31 13:32

>>147
Don't help them!!

Name: Anonymous 2010-01-04 5:01


#include <stdlib.h>
int main(){char*f="Fizz",*b="Buzz",i;for(i=0;i<101;i++)printf((i%3)?((i%5)?"%3$d\n":"%2$s\n"):((i%5)?"%s\n":"%s%s\n"),f,b,i);}

Name: Anonymous 2010-01-04 5:18

>>151

#include <stdlib.h>
int main(){char*f="Fizz",*b="Buzz",i;for(i=0;i<101;i++)printf(i%3?i%5?"%3$d\n":"%2$s\n":i%5?"%s\n":"%s%s\n",f,b,i);}

Name: Anonymous 2010-01-04 5:33

>>152

#include <stdlib.h>
int main(){char*f="Fizz",*b="Buzz\n",i;for(i=0;++i<101;)printf(i%3?i%5?"%3$d\n":b:i%5?"%s\n":"%s%s",f,b,i);}

Name: Anonymous 2010-01-04 7:24

>>153
i;main(){while(i++<100)printf("%s%s%.d\n",i%3?"":"Fizz",i%5?"":"Buzz",i%5&&i%3?i:0);}

Name: Anonymous 2010-01-04 8:42

>>154
#include <stdlib.h>
i;main(){while(i++<100)printf("%s%s%.d\n",i%3?"":"Fizz",i%5?"":"Buzz",i%15?i:0);}

Name: Anonymous 2010-01-04 10:02

>>155
#include <sys/mman.h>
main(){facepalm();}

Name: Anonymous 2010-01-04 11:21

int main(){return -1;}

Name: Anonymous 2010-01-04 12:08

i%3?"":"Fizz",i%5?"":"Buzz",i%15?i:0)
"1
"2
"Fizz3
"4
"Buzz5"
I might be misinterpreting the printf (I've always been bad about that) but this is not what the instructions ask.

Name: Anonymous 2010-01-04 14:41

MISINTERPRET MY ANUS

Name: Anonymous 2010-01-04 15:47

#include <fizzbuzz.c>

Name: Anonymous 2010-01-04 23:16

>>160
You should only include headers, not source files.

Name: Anonymous 2010-01-04 23:46

>>161
Bollocks. Tons of great reasons to use #include to include source files.

Name: Anonymous 2010-01-05 0:25

>>162
your an idiot hes right

Name: Anonymous 2010-01-05 0:26

>>162
Such as:

- templates

That's it. It's at best a workaround for limitations in C++. So many fucking hacks for backwards compatibility with C...

Name: Anonymous 2010-01-05 10:17

>>164
Come to think of it, do you guys believe that if it wasn't Stroustrup's intention to keep backward compatibility with C, would the C++ be any good?

Name: Anonymous 2010-01-05 10:18

>>165
What would C++ be then? Wasn't it created from the start with such intentions?

Name: Anonymous 2010-01-05 11:02

>>165
Of course not. The reason Sepples failed isn't because of backward compatibility. It's because Bjornie Stripstrap is a moron.

Name: Anonymous 2010-01-05 11:10

>>167
Sepples failed
*sigh*

Name: Anonymous 2010-01-05 12:01

>>168
THAT WHAT PRETENTIOUS TEENAGERS ACTUALLY BELIEVE!

Name: Anonymous 2010-01-05 12:31

>>167

The reason Sepples failed isn't because of backward compatibility.
But of course! Actually, that's the reason it's used at all.

And so, history repeats itself.

Name: dasuraga !8GgBtN/zr. 2010-01-05 14:08

what's with people and hating c++? It's syntaxically pretty ugly, but not at all unusable(at least I enjoy using it more than it's "safer" C-likes)

Name: Anonymous 2010-01-05 14:24

>>171
That's because you're either retarded or know no other languages. That's related to the discussion; it's my way of saying, "Have you read your FQA today?"

Name: Anonymous 2010-01-05 14:30

>>172
Yeah let's get back to hating proper /prauge/ style. Hate on FOIC and retarded ass Lispers and Haskallers

Name: Anonymous 2010-01-05 15:13

>>173
dont forget the enterprise

Name: Anonymous 2010-01-05 15:13

Any one of those, even FIOC, is better than Sepples.

Name: Anonymous 2010-01-05 15:15

>>174
dude, startrek is okay

Name: Anonymous 2010-01-05 23:11

fizzBuzz x | mod x 15 == 0 = "FizzBuzz " | mod x 5  == 0 = "Fizz " | mod x 3  == 0 = "Buzz " | otherwise = show x ++ " "
main = print [x | x <- [1..100], x <- fizzBuzz x]

Name: Anonymous 2010-01-06 0:15

EVERYONE, STEP THE FUCK BACK

#include <iostream>
int main()
{
std::cout << 1 << endl;
std::cout << 2 << endl;
std::cout << "Fizz" << endl;
std::cout << 4 << endl;
std::cout << "Buzz" << endl;
std::cout << "Fizz" << endl;
std::cout << 7 << endl;
std::cout << 8 << endl;
std::cout << "Fizz" << endl;
std::cout << "Buzz" << endl;
std::cout << 11 << endl;
std::cout << "Fizz" << endl;
std::cout << 13 << endl;
std::cout << 14 << endl;
std::cout << "FizzBuzz";
std::cout << 16 << endl;
std::cout << 17 << endl;
std::cout << "Fizz" << endl;
std::cout << 19 << endl;
std::cout << "Buzz" << endl;
std::cout << "Fizz" << endl;
std::cout << 22 << endl;
std::cout << 23 << endl;
std::cout << "Fizz" << endl;
std::cout << "Buzz" << endl;
std::cout << 26 << endl;
std::cout << "Fizz" << endl;
std::cout << 28 << endl;
std::cout << 29 << endl;
std::cout << "FizzBuzz" << endl;
std::cout << 31 << endl;
std::cout << 32 << endl;
std::cout << "Fizz" << endl;
std::cout << 34 << endl;
std::cout << "Buzz" << endl;
std::cout << "Fizz" << endl;
std::cout << 37 << endl;
std::cout << 38 << endl;
std::cout << "Fizz" << endl;
std::cout << "Buzz" << endl;
std::cout << 41 << endl;
std::cout << "Fizz" << endl;
std::cout << 43 << endl;
std::cout << 44 << endl;
std::cout << "FizzBuzz" << endl;
std::cout << 46 << endl;
std::cout << 47 << endl;
std::cout << "Fizz" << endl;
std::cout << 49 << endl;
std::cout << "Buzz" << endl;
std::cout << "Fizz" << endl;
std::cout << 52 << endl;
std::cout << 53 << endl;
std::cout << "Fizz" << endl;
std::cout << "Buzz" << endl;
std::cout << 56 << endl;
std::cout << "Fizz" << endl;
std::cout << 58 << endl;
std::cout << 59 << endl;
std::cout << "FizzBuzz" << endl;
std::cout << 61 << endl;
std::cout << 62 << endl;
std::cout << "Fizz" << endl;
std::cout << 64 << endl;
std::cout << "Buzz" << endl;
std::cout << "Fizz" << endl;
std::cout << 67 << endl;
std::cout << 68 << endl;
std::cout << "Fizz" << endl;
std::cout << "Buzz" << endl;
std::cout << 71 << endl;
std::cout << "Fizz" << endl;
std::cout << 73 << endl;
std::cout << 74 << endl;
std::cout << "FizzBuzz" << endl;
std::cout << 76 << endl;
std::cout << 77 << endl;
std::cout << "Fizz" << endl;
std::cout << 79 << endl;
std::cout << "Buzz" << endl;
std::cout << "Fizz" << endl;
std::cout << 82 << endl;
std::cout << 83 << endl;
std::cout << "Fizz" << endl;
std::cout << "Buzz" << endl;
std::cout << 86 << endl;
std::cout << "Fizz" << endl;
std::cout << 88 << endl;
std::cout << 89 << endl;
std::cout << "FizzBuzz" << endl;
std::cout << 91 << endl;
std::cout << 92 << endl;
std::cout << "Fizz" << endl;
std::cout << 94 << endl;
std::cout << "Buzz" << endl;
std::cout << "Fizz" << endl;
std::cout << 97 << endl;
std::cout << 98 << endl;
std::cout << "Fizz" << endl;
std::cout << "Buzz" << endl;
return 0;
}

Name: Anonymous 2010-01-06 0:27

>>177,178
[code] tags, please.

Name: Anonymous 2010-01-06 0:53

#include <iostream>
using std::cout;
using std::endl;

const int max = 100;

template <int val = 1>
struct Buzzer {
  Buzzer() {
    if (val % 15 == 0)
      cout << "fizzbuzz";
    else if (val % 3 == 0)
      cout << "fizz";
    else if (val % 5 == 0)
      cout << "buzz";
    else
      cout << val;
    cout << endl;
    if (val < max)
      Buzzer<val + 1>();
  }
};

template <>
struct Buzzer<max + 1> {};

int main() {
  Buzzer<>();
}


Did you know regular (non-class) functions can't have default template arguments? I didn't. I was also surprised to find that GCC's default template depth is 500.

I fucking hate sepples

Name: Anonymous 2010-01-06 1:06

Whoops, I left in that bogus line if (val < max) which doesn't actually do anything. Doesn't break it though.

Name: Anonymous 2010-01-06 3:06

>>177
What language is that anyway?

Name: Anonymous 2010-01-06 4:09

>>182
haxall

Name: Anonymous 2010-01-06 4:47

>>183
HAX ALL MY ANII

Name: Anonymous 2010-01-06 12:37

>>178

~ % g++ ">>178.cpp"
>>178.cpp: In function ‘int main()’:
>>178.cpp:4: error: ‘endl’ was not declared in this scope

Name: Anonymous 2010-01-06 18:40

This is currently the highest rated thread on Reddit, and the top 2 posts also have over 1000 upvotes each

http://www.reddit.com/r/funny/comments/alwm7/my_9_year_old_cousin_and_i_are_playing_a_game_of/

* Hilarity ensues!

Name: Anonymous 2010-01-06 21:31

>>185
FFFFFUUUUU-
my bad, forgot std::endl on each endl thing. using namespace std is such a bad habit =[


feels bad man

Name: Anonymous 2010-01-06 21:49

>>187
Something wrong with using std::endl;?

Name: Anonymous 2010-01-06 22:45

only a fool would dare give their function a name that conflicts with the standard fucking library

Name: Anonymous 2010-01-07 1:13

>>186
Reddit is down for maintenance.

Name: Anonymous 2010-01-07 1:16

>>190
Occasionally sites will tempporarily go down so the admins can perform kernel updates, moving databases, updating caches, etcetera. The best thing to do is spend time with family and friends.

Name: Anonymous 2010-01-07 1:20

>>191
Hi, been a long time lurker on this board.. but I feel I have to speak out at this moment.
 
Never on The 4Chan Programming board have I seen someone be so horrible and with no provocation, utterly appalling.
 
That was uncalled for and just plain rude.

Name: Anonymous 2010-01-07 14:03

>>190
And nothing of value was lost.

Name: Anonymous 2010-01-07 15:00

>>191
The best thing to do is spend time with family and friends.
spend time with family and friends.

you dont spend much time on /prog/, eh?
the proper answer would have been: programming.

Name: Anonymous 2010-01-08 2:12

>>194
you dont spend much time on /prog/, eh?
the proper answer would have been: anus haxing.

Name: Anonymous 2010-02-22 16:57

>>154
Bump to see if someone can get it in less characters.

Name: Anonymous 2010-02-22 17:06

fizz get

Name: Anonymous 2010-02-22 17:31

buzz set

Name: Anonymous 2010-02-22 17:31

fizzbuzz GET

Name: Anonymous 2010-02-22 17:50

>>199-200
Doing it WRONG

Name: Anonymous 2010-02-22 22:25

class FizzBuzz {
    public static void main(String[] args){

        int isNum =0;

        for (int i =0; i <100; i++) {
            isNum += (i % 3==0) ? 3 : 0;
            isNum += (i % 5==0) ? 5 : 0;
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); isNum = 0; break;
                case 5: System.out.println("Buzz: "+ i); isNum = 0; break;
                case 8: System.out.println("FizzBuzz"+ i); isNum = 0; break;
                default: System.out.println(i); isNum = 0; break;
            }
        }
    }
}

Name: Anonymous 2010-02-22 22:32

class FizzBuzz {
    public static void main(String[] args){

        int isNum =0;

        for (int i =0; i <100; i++) {
            isNum += (i % 3==0) ? 3 : 0;
            isNum += (i % 5==0) ? 5 : 0;
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); isNum = 0; break;
                case 5: System.out.println("Buzz: "+ i); isNum = 0; break;
                case 8: System.out.println("FizzBuzz"+ i); isNum = 0; break;
                default: System.out.println(i); isNum = 0; break;
            }
        }
    }
}

Name: Anonymous 2010-02-22 22:33

[code]
class FizzBuzz {
    public static void main(String[] args){

        int isNum =0;

        for (int i =0; i <100; i++) {
            isNum += (i % 3==0) ? 3 : 0;
            isNum += (i % 5==0) ? 5 : 0;
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); isNum = 0; break;
                case 5: System.out.println("Buzz: "+ i); isNum = 0; break;
                case 8: System.out.println("FizzBuzz"+ i); isNum = 0; break;
                default: System.out.println(i); isNum = 0; break;
            }
        }
    }
}
[code]

Name: Anonymous 2010-02-22 22:36

[code]class FizzBuzz {
    public static void main(String[] args){

        int isNum =0;

        for (int i =0; i <100; i++) {
            isNum += (i % 3==0) ? 3 : 0;
            isNum += (i % 5==0) ? 5 : 0;
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); isNum = 0; break;
                case 5: System.out.println("Buzz: "+ i); isNum = 0; break;
                case 8: System.out.println("FizzBuzz"+ i); isNum = 0; break;
                default: System.out.println(i); isNum = 0; break;
            }
        }
    }
}[\code]

Name: Anonymous 2010-02-22 22:37

class FizzBuzz {
    public static void main(String[] args){

        int isNum =0;

        for (int i =0; i <100; i++) {
            isNum += (i % 3==0) ? 3 : 0;
            isNum += (i % 5==0) ? 5 : 0;
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); isNum = 0; break;
                case 5: System.out.println("Buzz: "+ i); isNum = 0; break;
                case 8: System.out.println("FizzBuzz"+ i); isNum = 0; break;
                default: System.out.println(i); isNum = 0; break;
            }
        }
    }
}

Name: Anonymous 2010-02-23 1:11

>>202-206
...
Amid the successive failures, a note of suggestion.

isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);

You could also de-distribute the System.out.println(i); from all of the cases to the other side of the switch block but I'm not sure if that produces an optimization of run time along with reduction in redundancy.  It's probably not worth it.

Name: Anonymous 2010-02-23 1:30

class FizzBuzz {
    public static void main(String[] args){

        int isNum =0;

        for (int i =0; i <=100; ++i) {
        isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); isNum = 0; break;
                case 5: System.out.println("Buzz: "+ i); isNum = 0; break;
                case 8: System.out.println("FizzBuzz"+ i); isNum = 0; break;
                default: System.out.println(i); isNum = 0; break;
            }
        }
    }
}

Name: Anonymous 2010-02-23 1:34

#! /bin/sh

cycle='fizz $n buzz fizz $n $n fizz buzz $n fizz $n $n fizzbuzz $n $n'

echo 1
echo 2
set -- `seq 3 100`
while : ; do
  for i in $cycle ; do
    test $# -gt 0 || exit
    n=$1 ; shift
    eval echo $i
  done
done

Name: Anonymous 2010-02-23 1:35

(progn
  (format t "~{~A~^~%~}"
          (loop for i from 3 to 100
                collect (case (mod i 15)
                          ((3 6 9 12) "fizz")
                          ((5 10) "buzz")
                          (0 "fizzbuzz")
                          (t i))))
  (values))

Name: Anonymous 2010-02-23 1:37

class FizzBuzz {
    public static void main(String[] args){

        int isNum;

        for (int i =0; i <=100; ++i) {
        isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); break;
                case 5: System.out.println("Buzz: "+ i); break;
                case 8: System.out.println("FizzBuzz"+ i); break;
                default: System.out.println(i); break;
            }
        }
    }
}

Name: Anonymous 2010-02-23 1:38

class FizzBuzz {
    public static void main(String[] args){

        for (int i =0; i <=100; ++i) {
        int isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);
            switch (isNum) {
                case 3: System.out.println("Fizz: "+ i); break;
                case 5: System.out.println("Buzz: "+ i); break;
                case 8: System.out.println("FizzBuzz"+ i); break;
                default: System.out.println(i); break;
            }
        }
    }
}

Name: Anonymous 2010-02-23 1:42

--- >>208-fag   2010-02-23 07:40:53.809772132 +0100
+++ >>212-fag   2010-02-23 07:41:15.676762541 +0100
@@ -1,15 +1,13 @@
 class FizzBuzz {
     public static void main(String[] args){

-        int isNum =0;
-
         for (int i =0; i <=100; ++i) {
-        isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);
+        int isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);
             switch (isNum) {
-                case 3: System.out.println("Fizz: "+ i); isNum = 0; break;
-                case 5: System.out.println("Buzz: "+ i); isNum = 0; break;
-                case 8: System.out.println("FizzBuzz"+ i); isNum = 0; break;
-                default: System.out.println(i); isNum = 0; break;
+                case 3: System.out.println("Fizz: "+ i); break;
+                case 5: System.out.println("Buzz: "+ i); break;
+                case 8: System.out.println("FizzBuzz"+ i); break;
+                default: System.out.println(i); break;
             }
         }
     }

Name: Anonymous 2010-02-23 1:55

>>213
repeated dynamic memory allocation over single static allocation on stack.
Nice improvement, bro.

Name: Anonymous 2010-02-23 2:10

>>214
jvm does escape analysis and also no dangling pointers.

Name: Anonymous 2010-02-23 2:17

class FizzBuzz {
   public static void main(String[] args) {
      for (int i = 0, isNum = 0; i <= 100; ++i) {
         isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);
         switch (isNum) {
            case 3: System.out.println("Fizz: "+ i); break;
            case 5: System.out.println("Buzz: "+ i); break;
            case 8: System.out.println("FizzBuzz: "+ i); break;
            default: System.out.println(i); break;
         }
      }
   }
}

Sure is really Java in here.  Can someone program this in a language not yet used in the thread?

Name: Anonymous 2010-02-23 2:29

definitely too much coffee-fags around...

Name: Anonymous 2010-02-23 2:30

Just one more to drive the point home.
class FizzBuzz {
   public static void main(String[] args) {
      for (int i = 0; i <= 100; ++i) {
         System.out.println( (i%3==0 ? "Fizz" : "") + (i%5==0 ? "Buzz" : "") + " " + i);
      }
   }
}

Name: Anonymous 2010-02-23 2:46

>>218
for multiples of three print “Fizz” ...
>instead of the number

class FizzBuzz {
   public static void main(String[] args) {
      for (int i = 0, isNum = 0; i <= 100; ++i) {
         isNum = 0 + (i%3==0 ? 3 : 0) + (i%5==0 ? 5 : 0);
         switch (isNum) {
            case 3: System.out.println("Fizz"); break;
            case 5: System.out.println("Buzz"); break;
            case 8: System.out.println("FizzBuzz"); break;
            default: System.out.println(i); break;
         }
      }
   }
}

Name: Anonymous 2010-02-23 4:05


#lang scheme

(define (fizzbuzz x)
  (cond ((and (= 0 (modulo x 3)) (= 0 (modulo x 5))) (display "FizzBuzz"))
        ((= 0 (modulo x 3)) (display "Fizz"))
        ((= 0 (modulo x 5)) (display "Buzz"))
        (else (display x)))
  (newline)
  (if (< x 100)
      (fizzbuzz (+ x 1))
      (values)))

(fizzbuzz 1)

Name: Anonymous 2010-02-23 4:09

HAI
CAN HAS STDIO?
I HAS A VAR IZ 0
IM IN YR LOOP
    UPZ VAR!!1
    IZ VAR BIGR THAN 100?
        GTFO.
    KTHX
    IZ VAR LEFTOVAR 15 LIEK 0?
        VISIBLE "FIZZBUZZ"
    KTHX
    ORLY?
    IZ VAR LEFTOVAR 5 LIEK 0?
        VISIBLE "BUZZ"
    KTHX
    ORLY?
    IZ VAR LEFTOVAR 3 LIEK 0?
        VISIBLE "FIZZ"
    KTHX
    NOWAI
        VISIBLE VAR
    KTHX
KTHX
KTHXBYE

Name: Anonymous 2010-02-23 10:37

>>219
Ah, sorry.  I based it on the repetitions of >>203 onwards where that was a feature for whatever reason.

Name: Anonymous 2010-02-23 12:25

>>220
modulo
remainder

Name: Anonymous 2011-05-22 12:24

Never gets old.

Name: Anonymous 2011-05-22 12:27

>>224
IN-CORRECT.

I like how the default language for syntax parsing is Visual Basic. That's pretty upfucked.

Name: Anonymous 2011-05-22 13:12

So this was all a test to see what type of programmer you are?

Anyways, I did it in ~2 minutes 15 seconds ..


<script type="text/javascript">
var lineBreak = "<br />";
for(var i = 0; i <= 100; i += 1)
  if(i <= 0)
    document.write(i + lineBreak);
  else if(i % 3 === 0 && i % 5 === 0)
    document.write("Fizz-Buzz" + lineBreak);
  else if(i % 3 === 0)
    document.write("Fizz" + lineBreak);
  else if(i % 5 === 0)
    document.write("Buzz" + lineBreak);
  else
    document.write(i + lineBreak);
</script>

Don't change these.
Name: Email:
Entire Thread Thread List