class TestFor { public static void main(String[] args) { //int i=0; int sum = 0; int count = 0; for(int i=0;i<=100;i++){ if(i%2==0){ System.out.println( i ); sum+=i; count++; } } System.out.println("总和为:"+sum); System.out.println("个数为:"+count); //int j=1; //for(System.out.print(‘a‘);j<3;System.out.print(‘b‘),j++){ //System.out.print(‘c‘); //} } }
时间: 2024-10-10 23:55:03