【第三周】第三章习题3.7
来源:互联网 发布:js去掉前面的空格 编辑:程序博客网 时间:2024/05/17 21:07
/*2016.9.15 * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. *//** *编写一个应用程序求满足1+2!+3!……+N!《=9999的最大整数N * * @author 马康泰 */public class Main { public static void main(String args[]){ int sum=0,fac=0; int n=1; Factorial a=new Factorial(); while(sum<=9999){ fac=a.factorial(n); sum=sum+fac; n++; } System.out.println(n); }} * To change this template file, choose Tools | Templates * and open the template in the editor. *//** * * @author 马康泰 */public class Factorial { public int factorial(int i){//阶乘 int j,result=1; for(j=1;j<=i;j++){ result=result*j; } return result; }}
0 0
- 【第三周】第三章习题3.7
- 【第三周】第三章习题3.5
- 【第三周】第三章习题3.6
- 第三周 习题
- 第三章习题
- C++习题第三章
- 第三章习题汇总
- 第三章习题 T2
- 第三章习题T3
- 第三章习题T4
- 第三章习题T5
- 第三章习题T6
- 第三章习题
- 第三章习题
- 第三章习题
- 第三章习题5.3
- C++primer第三章习题3.7
- LeetCode 算法习题 第三周
- 基数排序(Radix Sort)的代码实现
- 网易2017校园招聘笔试题:回文序列
- win7下装win10双系统
- 【神经网络与深度学习】学习笔记:AlexNet&Imagenet学习笔记
- 计算机网络
- 【第三周】第三章习题3.7
- python3.4爬虫——urllib等模块的引用
- 求单链表的长度(可能有环)
- 38. Count and Say
- GDB调试
- 线性表的归并排序
- Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
- 【神经网络与深度学习】卷积神经网络-进化史:从LeNet到AlexNet
- OC-检测UITextView输入内容字数加限制