
Originally Posted by
dsr
If you
really want 1 line:
Code:
int factorial(int x) {if (x==1||x==0) return 1; else return factorial(x-1)*x;}
[/b]
Wouldn't this work and be a bit less messy?
Code:
int factorial(int x) { (x==1||x==0) ? return 1 : return factorial(x-1)*x;}
Bookmarks