2007-12-06 Jb Evain <jbevain@novell.com>
[mono.git] / mono / tests / fib.cs
blobeca6065a17856af58ad7eaba58f03c53736abd4c
1 using System;
3 public class Fib {
5 public static int fib (int n) {
6 if (n < 2)
7 return 1;
8 return fib(n-2)+fib(n-1);
10 public static int Main (string[] args) {
11 int repeat = 1;
13 if (args.Length == 1)
14 repeat = Convert.ToInt32 (args [0]);
16 // Console.WriteLine ("Repeat = " + repeat);
18 if (repeat > 32) {
19 Console.WriteLine ("{0}", fib (repeat));
20 return 0;
23 for (int i = 0; i < repeat; i++)
24 if (fib (32) != 3524578)
25 return 1;
27 return 0;