public static void test4(){ int sum = 0; //求和 for(int i =1;i<=100;i++){ if(i%3!=0){ sum=sum+i; } } System.out.println("和是:"+sum); }