第四周作业
package set; import java.util.Scanner; public class NEXT { public static void main(String[] args) { // TODO Auto-generated method stub int b=0; for (int a=1;a<=100;a++) { if(a%3==0) { b+=a; } } System.out.println(b); } }
package set; import java.util.Scanner; public class NEXT { public static void main(String[] args) { // TODO Auto-generated method stub int a=1; int b=0; while(a<=100){ a++; if(a%3==0) { b+=a; } } System.out.println(b); } }
package set; import java.util.Scanner; public class NEXT { public static void main(String[] args) { // TODO Auto-generated method stub int a=1; int b=0; do {a++; if(a%3==0){ b+=a; } } while(a<=100); System.out.println(b); }}
package set; import java.util.Scanner; public class NEXT { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int a=0; while(a<=9) { if(a==5) { a++; continue; } System.out.print(a); a++; } } }
package set; import java.util.Scanner; public class SKS { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int n=input.nextInt(); int a=1; for(int b=1;b<=n;b++) { a*=b; } System.out.println(a); } }
package set; import java.util.Scanner; public class SKS { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int a =input.nextInt(); if(a<0||a>100){ System.out.println("输入错误"); } else { System.out.println(a); } } }
package set; import java.util.Scanner; public class SKS { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); double a =30000; double c =30000; for(int b=1;b<=10;b++) { c=a*(1+0.06); c=c+a; } System.out.println("总收入是"+c); } }