Example
// this program finds the factorial (n!) of an integer
#include <iostream.h>
factr(int n);
main()
cout << "4 factorial is "<<factr(4);
return 0;
}
factr(int n)
{
int answer;
if(n==1)return(1);
answer=factr(n-1)*n;// calling the function within itself
return(answer);
}