当前位置:网站首页>Find the sum of numbers between 1 and 100 that cannot be divided by 3

Find the sum of numbers between 1 and 100 that cannot be divided by 3

2022-07-23 11:57:00 shuo277

public static void main(String[] args) {
    int sum=0;
    for (int i=0; i<=100;i++){
        if(i%3!=0){
            sum +=i;
        }
    }
    System.out.println("1~100 Can't be 3 The sum of divisible numbers is :"+sum);
}
原网站

版权声明
本文为[shuo277]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207230538517714.html