Frage im Vorstellungsgespräch bei Goldman Sachs

Recursive calculate n! Write down code

Antworten zu Vorstellungsgespräch

Anonym

2. Okt. 2011

int factorial(int n) { if(n==0) // calculates zero factorial which is equal to 1 return 1; else return n*fact(n-1); }

2

Anonym

18. Apr. 2011

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