Thursday, April 15, 2010

Output!

#include
using namespace std;

int fact(int n){
if(n == 1){
return 1;
}
else{
return fact(n-1)*n;
}
}

int main(){
cout<<
fact(6)
return 0;
}

for this program's output, you can see it as ((((((1)*2)*3)*4)*5)*6)=720.

0 comments:

Post a Comment