Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace test
- {
- class Program
- {
- static int Func (int a, int b, int i, int n)
- {
- if (n == 1)
- return a;
- if (n == 2)
- return b;
- int new_a = Math.Abs (a) - 6 * b;
- if (i < n - 2)
- return Func (new_a, a, i++, n);
- else
- return new_a;
- }
- static void Main ()
- {
- Console.WriteLine ("Enter n ");
- int n = int.Parse (Console.ReadLine ());
- int res = Func (-10, 2, 1, n);
- Console.WriteLine ("Result = {0} ", res);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment