/* 5.10 write a function to obtain the nth entry of the Fibonacci series */
# Include "stdio. H"
Int maid (int n );
Void main ()
{
Int N;
Printf ("Calculate the nth entry of the Fibonacci series, enter n \ n ");
Scanf ("% d", & N);/* the value of N in vc6 must be less? */
Printf ("the % d of the Fibonacci series is % d", N, Fibonacci (n ));
}
Int Fibonacci (int n)
{
If (n = 1 | n = 2)
Return 1;
Else
Return maid (n-1) + maid (n-2 );
}
/* 5.11 write a function to determine whether an integer is a return number palindrome */
# Include "stdio. H"
Int palindrome (long N );
Void main ()
{
Long N;
Printf ("to determine whether an integer is a return number, enter n \ n ");
Scanf ("% lD", & N );
If (palindrome (n ))
Printf ("% LD is the number of replies", N );
Else
Printf ("% LD is not the number of replies", N );
}
Int palindrome (long N)
{
Int I, bit = 0;
Int A [10];
While (n! = 0)
{
A [bit] = n % 10;
N = N/10;
Bit ++;
}
For (I = 0; I <bit/2; I ++)
{
If (A [I]! = A [bit-1-i])
Return 0;
}
Return 1;
}
/* 5.12 write a function and calculate the N power of X. N is not less than 0 integer n> = 0
*/
# Include "stdio. H"
Double Power (Double X, int N );
Void main ()
{
Int N;
Double X;
Printf ("Calculate the N power of X, enter X and N, and separate numbers with spaces \ n ");
Scanf ("% lf % d", & X, & N );
Printf ("% lf % d times are % lf", X, N, power (x, n ));
}
Double Power (Double X, int N)
{
If (n = 0)
Return 1;
Else
Return (x * power (x, n-1 ));
}
/* 5.13 compile a function and use a recursive method to calculate the value of the n-order levender polynomial */
# Include "stdio. H"
# Include "conio. H"
Double P (Double X, int N );
Void main ()
{
Double X; int N;
Printf ("Calculate the polynomial of the n-order levender, enter X and N \ n ");
Scanf ("% lf % d", & X, & N );
Printf ("Result: % lf", P (x, n ));
Getch ();
}
Double P (Double X, int N)
{
If (n = 0) return 1;
If (n = 1) return X;
If (n> 1) Return (2 * N-1) * X-P (x, n-1)-(n-1) * p (x, N-2)/N;
}