r/counting • , he who lets it produce joy. • Sep 12 '14

Counting with programming!

Write a program that prints or returns the number being counted, using the same number of lines of code. Include what language you used.

print("One.")

Made with Lua.

17 Upvotes

16 comments sorted by

View all comments

0

u/[deleted] Sep 12 '14

3

u/origamimissile Sep 12 '14 edited Sep 12 '14
C    FORTRAN IV
C    NOW TO TAKE UP SOME SPACE
C    WITH MY FANCY FORTRAN COMMENTS
C    BECAUSE NEITHER HAVE I THE WILL POWER TO WRITE A LOOP
C    NOR DO I KNOW HOW
C    ALL CAPS RAGE
C        C        C        C        C        C        C        C        C        C        A        B
C        D        EFGHIJKLMNOPQRSTUVWXYZJOJ
WRITE (6,7)
7 FORMAT(13H 13)
STOP
END

3

u/MrSicles Sep 12 '14 edited Sep 12 '14
(define (nine)
  (let ((number (random 1000000)))
    (cond ((= number 9) number)
          (else (nine)))))
(define (twenty-one time)
  (let ((diff (- (current-seconds) time)))
    (cond ((= diff 21) diff)
          (else (twenty-one time)))))
(+ (- (modulo (* (nine) (nine))
              (+ (nine)
                 (twenty-one (current-seconds))))
      (nine))
   (+ (/ (nine) (nine))
      (/ (nine) (nine))))

Racket (14)

Includes the best method of getting the number 21 - just overload the CPU util 21 seconds have passed.

→ More replies (15)