### iterative and recursive functions

I am writing a program that uses the iterative and recursive functions to find solution (and times) for factorial using the equation
c(n,r)= n! /(r! * (n - r)!) while r=3, n=20 and then when r = 10 and n = 1000.

This is my code so far....?

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859`` `````` #include #include #include using std::cout; using std::endl; long double recursive_func(long double n, long double r); long double iterative_func(long double n, long double r); int main() { typedef struct timeval time; time stop, start; long double result; gettimeofday(&start, NULL); iterative_func (20, 3); //call the function to be timed with these numbers recursive_func(20,3); //call the function to be timed with these numbers iterative_func(1000, 10); //call the function to be timed with these numbers recursive_func(1000, 10); //call the function to be timed with these numbers gettimeofday(&stop, NULL); resultrec1 = recursive_func(n,r); //somehow need to be able to print out each of the results cout << result <, endl; //somehow need to be able to print out each of the results if (stop.tv_sec > start.tv_sec) cout << "Seconds: " << stop.tv_sec - start.tv_sec << endl; else cout << "Micro: " << stop.tv_usec - start.tv_usec << endl; return 0; } long double recursive_func(long double n, long double r) { if (n == r || r == 0) return 1; else { return (recursive_func(n / r)) * (recursive_func(n-1, r-1)); } } long double iterative_func(long double n, long double r) { int total = 1; int i; cin >> n; cin>>r; for (i = 1; i <= n; i++) { total *= i; } } ``````
Any ideas on how to correct my code?

Thanks!