Want more features on Pastebin? Sign Up, it's FREE!
Guest

inscrutable

By: a guest on Jul 15th, 2009  |  syntax: C#  |  size: 0.69 KB  |  views: 60  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.             string result;
  2.  
  3.             if (n == 0)
  4.                 result = "1";
  5.             else if (n == 1)
  6.                 result = "2";
  7.             else
  8.             {
  9.                 double numerator = 3;
  10.                 double denominator = 2;
  11.                 for (int i = 2; i < n; i++)
  12.                 {
  13.                     double temp = numerator;
  14.                     numerator = denominator;
  15.                     denominator = temp;
  16.                     numerator += denominator;
  17.                    
  18.                 }
  19.                 result = numerator + "/" + denominator + " = " + (numerator / denominator);
  20.             }
  21.  
  22.             Console.WriteLine("Result: " + result);
clone this paste RAW Paste Data