Tuesday, February 24, 2015

Mc Carthy java in a pgm




McCarthy.java

public class McCarthy
{

   public static int mcCarthy(int n)
  {
      if (n > 100)
         return n - 10;
      return mcCarthy(mcCarthy(n+11));
   }

   public static void main(String[] args)
  {
      int N = Integer.parseInt(args[0]);
      System.out.println(mcCarthy(N));
   }
}

No comments:

Post a Comment