java while 练习

java--while
统计100以内 6的倍数的个数;

class TestCompartor  {
    
    public static void main(String[] args) {
    
        int i  =1; 
        int n = 0;
        while (i <= 100){
            if(i % 6 == 0 ){
                n ++;               
            }
            i++;            
        }   
        System.out.println("n="+n);
    }   
}

标签: none