public class HelloWorld{
public static void main(String[] args) {
double avg1=78.5;
double rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
}
}
酱油酱油
public static void main(String[] args) {
double avg1=78.5;
double rise=5;
double avg2=avg1+rise;
System.out.println("考试平均分:"+avg1);
System.out.println("调整后的平均分:"+avg2);
}
}
酱油酱油
2015-03-22
public class HelloWorld{
public static void main(String[] args){
int sum=0;
for(int i=1;i<=10;i++){
sum+=i;
if(sum>20){
System.out.println(sum);
break;
}
}
}
}
public static void main(String[] args){
int sum=0;
for(int i=1;i<=10;i++){
sum+=i;
if(sum>20){
System.out.println(sum);
break;
}
}
}
}
2015-03-22
public class HalloWorld{
public static void main(String[] args){
int sum=0;
for(int i=1;i<=100;i++){
if(i%3==0)
sum+=i;
}
System.out.println("1-100之间不能被3整除的数之和为:"+sum);
}}
public static void main(String[] args){
int sum=0;
for(int i=1;i<=100;i++){
if(i%3==0)
sum+=i;
}
System.out.println("1-100之间不能被3整除的数之和为:"+sum);
}}
2015-03-22
public class HelloWorld{
public static void main(String[] args){
int sum=0;
int num=2;
do{
sum+=num;
num+=2;
}while(num<=50)
System.out.println("50以内的偶数和为:"+sum);
}
}
public static void main(String[] args){
int sum=0;
int num=2;
do{
sum+=num;
num+=2;
}while(num<=50)
System.out.println("50以内的偶数和为:"+sum);
}
}
2015-03-22