Jan 26, 2008

The one line C#2.0 program for Fibonacci numbers.

I wrote one line Ruby program for Fibonacci numbers.
The one line Ruby program for Fibonacci numbers.

Ruby is a dynamically-typed programming language.
C# is a statically-typed programming language.

Let's write one line C#2.0 program for Fibonacci numbers.

This is the result.

1
1
2
3
5
8
13
21
34
55

This is the one line program.

new EventHandler(delegate(object s,EventArgs e){while(((int[])s)[2]++<10)if(Console.WriteLine(((int[])s)[1]=(((int[])s)[0]=((int[])s)[0]+((int[])s)[1])-((int[])s)[1])is Object){}}).Invoke(new int[]{1,0,0},null);


This is the statically-typed programming language.

No comments: