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

One Line Factorial

Name: Anonymous 2009-06-15 15:56

for(int a1=1,a2=1,i=scanf_s("%d",&i)+i-1;(i--)>2; a1=(a2+=a1)-a1,(i==2)?printf_s("Result=%d\n",a2):NULL)

Name: Anonymous 2009-06-15 16:23

fact x = if x == 0 then 1 else x * fact(x-1)

Alternatively,
fact x = if x == 0 then 1 else x * fact(x-1);main=readLn >>= print.fact

Name: Anonymous 2009-06-15 16:28

Can your C do this?
f@(_:fs) = 0 : 1 : zipWith (+) f fs

Name: Anonymous 2009-06-15 16:36

from IntroductoryExercises import Fibonacci;
    main = fib;

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