Other Programs/Other C Programs/recursion.c
int mystery( int a, int b )
{
   if ( b == 1 )
      return a;
   else
      return a + mystery( a, b - 1 );
}
/* Parameter b must be a positive  
   integer to prevent infinite recursion */
Parameter b must be a positive
integer to prevent infinite recursion
Parameter b must be a positive integer to prevent infinite recursion
int mystery( int a, int b )
{
   if ( b == 1 )
      return a;
   else
      return a + mystery( a, b - 1 );
}
int mystery ( int a , int b ) { if ( b == 1 ) return a ; else return a + mystery ( a , b - 1 ) ; }
Parameter b must be a positive
integer to prevent infinite recursion
Parameter b must be a positive integer to prevent infinite recursion