int myfac(int n){ int result = 1; if (n != 0) { while(n != 1) result *= n--; } return result;}这样如果n的数很大的话会有问题,需要用大数乘法的知识,估计你也用不到吧!