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

fizzbuzz

Name: übermench 2011-12-26 15:04

just wanted to post my awesome fizzbuzz implementation
#include <stdio.h>
#include <stdlib.h>

void main(int j) {
  printf(((char*[]){"%d\n","fizz\n","buzz\n","fizzbuzz\n"})[!(j%3)+!(j%5)*2], j);
  (&main + (&exit - &main)*(j/100))((j+1)*(1-j/100) );
}

Name: Anonymous 2011-12-27 10:33


(defun mult? (n m)
  (eql (mod n m) 0))

(defun fizz-buzz ()
  (dotimes (x 100)
    (if (mult? (1+ x) 3)
    (format t "Fizz"))
    (if (mult? (1+ x) 5)
    (format t "Buzz")
    ;; else
    (if (not (mult? (1+ x) 3))
        (format t "~d" (1+ x))))
    (format t "~%")))


Help me OPTIMIZE this, I'm still learning.

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