int jh = 10; double jc = 1; double sum = 0; double a = 1; while(jc <= jh) { a = a * jc; a = 1 / a; jc++; sum = sum + a; } System.out.println("阶乘和为:"+sum);
时间: 2024-12-22 01:30:12
int jh = 10; double jc = 1; double sum = 0; double a = 1; while(jc <= jh) { a = a * jc; a = 1 / a; jc++; sum = sum + a; } System.out.println("阶乘和为:"+sum);