搜索结果
查询Tags标签: jiecheng,共有 4条记录-
java阶乘
public static int jiecheng(int n){ //计算机阶乘int m=1;if (n<0)return -1;if (n==0)return 1;if (n>0){for (int i=1;i<=n;i++)m=m*i;} return m;}
2022/1/20 20:13:31 人评论 次浏览 -
java阶乘
public static int jiecheng(int n){ //计算机阶乘int m=1;if (n<0)return -1;if (n==0)return 1;if (n>0){for (int i=1;i<=n;i++)m=m*i;} return m;}
2022/1/20 20:13:31 人评论 次浏览 -
python 实现阶乘计算的三种方式
def jiecheng(num,result):if num>1:result = num*resultnum-=1jiecheng(num,result)else:print(result=, result)# jiecheng(5, 1)def jiecheng2(num,result):for i in range(1,num+1):# print(i)result*=iprint(result=,result)# jiecheng2(5,1)from functools impor…
2022/1/9 20:04:40 人评论 次浏览 -
python 实现阶乘计算的三种方式
def jiecheng(num,result):if num>1:result = num*resultnum-=1jiecheng(num,result)else:print(result=, result)# jiecheng(5, 1)def jiecheng2(num,result):for i in range(1,num+1):# print(i)result*=iprint(result=,result)# jiecheng2(5,1)from functools impor…
2022/1/9 20:04:40 人评论 次浏览