Saturday, August 16, 2008

ISC 2008 Reverse a string to check Palindrome through Recursion

Link for Downloading Full Program C++ version


ISC 2007 Decimal to Binary conversion through Recursion

Link for Downloading Full Program C++ version

void recursive(int x)

  {
  int m=x%2;
  x=x/2;
  if(x>0) recursive(x);
  z=z*10+m;
  }

ISC 2007 Digit to word conversion through Recursion

Link for Downloading Full Program C++ version

void extdigit(int x)
  {
        int m=x%10;
        x=x/10;
         if(x>0) extdigit(x);
         numtoword(m);
  }
  void numtoword(int p)
  {
       char a[10][10]={"Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"};
       cout<    }

ISC 2006 HCF and LCM through Recursion

Link for Downloading Full Program C++ version

int rechcf(int p,int q)
{
      if(p==0) return q;
           else return rechcf(q%p, p);
}  
int fn_lcm(int p,int q, int gcd)
{
            return p*q/gcd;
}

ISC 2005 Fibonacci Series through Recursion

Link for Downloading full program C++

VERSION I

int fib(int n)
  {
  if(n==1) return 0;
  else if(n==2) return 1;
  else if(n>2) return fib(n-1)+fib(n-2);
  else return -1;
  }
loop from 1 to the limit

display fib(i)

VERSION II

fibrec()
{
 a=0;      b=1;
 }
int fib(int n)
{
if(n>0)
{
c = a + b;      a = b;       b = c;
display c;

n--;

fib(n);
}
return b;
}



Tuesday, August 12, 2008

QUESTION BASED ON RECURSION
Ques 1. A class Revstr defines a recursive function to reverse a string and check whether it is a Palindrome. .............
(ISC 2008 Link for full question )

Ques 2. Class Convert has been defined to express digits of an integer in words.
.............
(ISC 2007 Link for full question )

Ques 3. A class dec_Bin has been defined to convert a decimal number into its equivalent binary number.
.............
(ISC 2007R Link for full question )

Ques 4.
Class Hifact has been defined to to find the HCF of two numbers using the recursive technique. This HCF is used to find the LCM of the two numbers..............
(ISC 2006 Link for full question )

Ques 5. A class recursion is defined to find the fibonacci series upto the n terms.
..............
(ISC 2005 Link for full question )

Ques 6. Additional question
( Link for full question )

Ques 7. Additional question
( Link for full question )