package klflianxi;
public class klf {public static void main(String[] args) {
// 变量保存成绩
int score = 53;
// 变量保存加分次数
int count = 0;
System.out.println("加分前成绩:"+score);//打印输出加分前成绩
if(score<60)// 只要成绩小于60,就循环执行加分操作,并统计加分次数
{
while(score>60)
{
score++;
count++;
}System.out.println("加分后分数:"+score);
System.out.println("共加了“+count+”次!");//打印输出加分后成绩,以及加分次数
}
}}
为什么运行结果是加分前成绩:53
加分后分数:53
共加了“+count+”次!新手求教大神ziom
相关分类