public class HelloWorld{
public static void main(String[] args){
int score =70;
int count=0;
System.out.println("加分前成绩"+score);
if(score<60){
while(score!=60){
score++;
count++;
}
System.out.println("加分前后成绩"+score);
System.out.println("共加了"+count+"次");
}else{System.out.println("成绩合格");
}
}
}
public static void main(String[] args){
int score =70;
int count=0;
System.out.println("加分前成绩"+score);
if(score<60){
while(score!=60){
score++;
count++;
}
System.out.println("加分前后成绩"+score);
System.out.println("共加了"+count+"次");
}else{System.out.println("成绩合格");
}
}
}
int sum=age1+age2+age3+age4;
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1
System.out.println("年龄总和:"+sum);
System.out.println("平均年龄:"+avg);
System.out.println("年龄差值:"+minus);
System.out.println("自减后的年龄:"+newAge);
}怎么不对呢?求教
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1
System.out.println("年龄总和:"+sum);
System.out.println("平均年龄:"+avg);
System.out.println("年龄差值:"+minus);
System.out.println("自减后的年龄:"+newAge);
}怎么不对呢?求教
2015-07-30
int age1=24;
int age2=18;
int age3=36;
int age4=27;
int sum=age1+age2+age3+age4;
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1
System.out.println("年龄总和:"+sum);
System.out.println("平均年龄:"+avg);
System.out.println("年龄差值:"+minus);
System.out.println("自减后的年龄:"+newAge);
}
int age2=18;
int age3=36;
int age4=27;
int sum=age1+age2+age3+age4;
double avg=(age1+age2+age3+age4)/4;
int minus=age1-age2;
int newAge=--age1
System.out.println("年龄总和:"+sum);
System.out.println("平均年龄:"+avg);
System.out.println("年龄差值:"+minus);
System.out.println("自减后的年龄:"+newAge);
}
2015-07-30