java代码示例(4)

此页面是否是列表页或首页?未找到合适正文内容。

java代码示例(4)

标签:loopi++todoextnextgeneratedspan成绩color

1 /**
2 * 需求分析:计算100以内的和,用while
3 * @author chenyanlong
4 * 日期:2017/10/14
5 */
6 package com.hp.test04;
7
8 public class HS_Loop1 {
9
10 public static void main(String[] args) {
11 // TODO Auto-generated method stub
12 int i=1,sum=0;
13
14 while(i<=100){
15 sum=sum+i;
16 i++;
17 }
18 System.out.println(\”100以内的和:\”+sum);
19 }
20
21 }

1 /**
2 * 需求分析:计算100以内的和,用while
3 * @author chenyanlong
4 * 日期:2017/10/14
5 */
6 package com.hp.test04;
7
8 public class HS_Loop1 {
9
10 public static void main(String[] args) {
11 // TODO Auto-generated method stub
12 int i=1,sum=0;
13
14 while(i<=100){
15 sum=sum+i;
16 i++;
17 }
18 System.out.println(\”100以内的和:\”+sum);
19 }
20
21 }

1 /**
2 * 需求分析:输入5门成绩求平均分

作者: liuzhihao

为您推荐

返回顶部