Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / fib.cs
1 using System;
2
3 public class Fib {
4
5         public static int fib (int n) {
6                 if (n < 2)
7                         return 1;
8                 return fib(n-2)+fib(n-1);
9         }
10         public static int Main (string[] args) {
11                 int repeat = 1;
12                 
13                 if (args.Length == 1)
14                         repeat = Convert.ToInt32 (args [0]);
15                 
16 //              Console.WriteLine ("Repeat = " + repeat);
17
18                 if (repeat > 32) {
19                         Console.WriteLine ("{0}", fib (repeat));
20                         return 0;
21                 }
22                         
23                 for (int i = 0; i < repeat; i++)
24                         if (fib (32) != 3524578)
25                                 return 1;
26
27                 return 0;
28         }
29 }
30
31