int calcFactorial(int val1) { int i; for(i=val1 - 1; i>1; i--) { val1 *=i; } if ( i == 0) { return 1; } return val1; }