#include
int factorialRecursive(int);
int factorialIterative(int);
int fibonacciRecursive(int);
int fibonacciIterative(int);
int gcdRecursive(int,int);
int gcdIterative(int,int);
int powerRecursive(int,int);
int powerIterative(int,int);
int digProductRecursive(int);
int digProductIterative(int);
int main(void){
int command1, command2, x,y;
while(1){
printf("\n1 - int Factorial(int x);");
printf("\n2 - int Fibonacci(int x);");
printf("\n3 - int Gcd(int x,int y);");
printf("\n4 - double Power(int x,int y);");
printf("\n5 - int digProduct(int x);");
printf("\n0 - QUIT\n");
printf("Please enter a section:");
scanf("%d",command1);
if(command1==0){
printf("Goodbye.");
return 0;
}
if(command1=1;i--){
factorial=factorial*i;
}
return factorial;
}
int fibonacciRecursive(int x){
if(x==0||x==1){
if(x==0)
return 0;
else
return 1;
}
else{
return fibonacciRecursive(x-1)+fibonacciRecursive(x-2);
}
}
int fibonacciIterative(int x){
int fibonacci[x+1],i;
fibonacci[0]=0;
fibonacci[1]=1;
for(i=2;i=y){
for(i=y;i>=1;i--){
if(x%i==0y%i==0)
break;
}
return i;
}
else{
for(i=x;i>=1;i--){
if(x%i==0y%i==0)
break;
}
return i;
}
}
int powerRecursive(int a,int b){
if(b==0){
return 1;
}
else{
return a*powerRecursive(a,--b);
}
}
int powerIterative(int a,int b){
int ans=1,i;
for(i=1;i=10){
product= product * (x%10);
x=x/10;
}
return product;
}