public class Test5 {
public static void main(String[] args) {
//2010上网人数8000万,假设每年按百分之三十增长,问那一年人数增长到三亿
int year = 2010;
int persons = 8000;
while (persons<30000){
year ++;
persons = (int)(persons*(1+0.3));
System.out.println(year+"--"+persons);
}
System.out.println(year);
}
}
public class Test5 {
public static void main(String[] args) {
//计算100以内的偶数之和
int sum = 0;
int i = 1;
while (i<=100){
if(i % 2 == 0) {
sum = sum + i;
}
i++;
}
System.out.println(sum);
}
}