C PROGRAMMING FOR SOME ALGORITHMS
- To write a recursive function to print the factorial of a number and execute it to find the factorial of 6.
unsigned long fact(int);
unsigned long f;
printf(“\nEnter a number: “);
printf(“\nFactorial of %d is %ld”,n,f);
unsigned long fact(int n)
unsigned long m;
The Execution of the program to find the factorial of 6 is yields:-
Enter a Number:
Factorial of 6 is 720
- To write a recursive function to print the Fibonacci series up to a given number and write the series up to 89.
unsigned long ...