第四次java作业
import java.util.Scanner; public class fff{ public static void main(String[] args){
import java.util.Scanner; public class fff { public static void main(String[] args){ int x=1; int sum=0; while(x<=100){ if(x%3==0){ sum+=x; x++; }else{ x++; } } System.out.println(sum); } }
import java.util.Scanner; public class fff { public static void main(String[] args){ int x=1; int sum=0; do{ if(x%3==0){ sum+=x; x++; }else{ x++; } }while(x<=100); System.out.println(sum);
import java.util.Scanner; public class fff { public static void main(String[] args){ int x=0; while(x<10){ if(x!=5){ System.out.println(x); x++; }else{ x++; }
import java.util.Scanner; public class fff{ public static void main(String[] args){ double x=30000; double sum=30000; int a; for(a=2;a<11;a++){ x=x*(1.06); sum+=x; } System.out.println("10年后的年薪为"+x); System.out.println("未来10年总收入为"+sum); } }
}
}
}
}
}
int x; int sum=0; for(x=1;x<=100;x++){ if(x%3==0){ sum+=x; } } System.out.println(sum); } }
import java.util.Scanner; public class fff { public static void main(String[] args){ int x=1; int sum=0; while(x<=100){ if(x%3==0){ sum+=x; x++; }else{ x++; } } System.out.println(sum); } }