求和
所属分类:Java编程
开发工具:Java
文件大小:2KB
下载次数:0
上传日期:2019-02-19 15:29:42
上 传 者:
strawfree
说明: 要求:
计算1-100之间的所有的奇数和
1+3+5+7...+99
有1个数据,从0变到100 循环 int =0 <= 100 ++
从0-100,范围内,找到奇数 数%2==1 奇数
所有的奇数求和计算
需要变量,保存奇数的求和
实现步骤:
1. 程序可以使用到的数据,预先定义好变量
需要奇数和
2. 利用循环,让变量从0变化到100
3. 判断变量的变化情况是不是奇数
4. 如果是奇数,和预先定义好的变量,求和
(Requirement:
Calculate the sum of all odd numbers between 1 and 100
1+3+5+7...+99
There is one data, from 0 to 100 loop int = 0 <= 100++
From 0-100, find odd number% 2==1 odd number.
All odd sum calculations
Variables are needed to preserve the sum of odd numbers
Implementation steps:
1. Data that can be used by the program and variables are predefined
Need odd sum
2. Use loops to change variables from 0 to 100
3. Is it odd to judge the change of variables?
4. If it's odd, sum with predefined variables.)
文件列表:
LoopTest_1.java (912, 2016-07-20)
LoopTest_2.java (543, 2016-07-20)
LoopTest_3.java (533, 2016-07-20)
LoopTest.java (837, 2016-07-20)
近期下载者:
相关文件:
收藏者: