struct-LablelDemo

package com.kuang.struct;

public class LablelDemo {
    public static void main(String[] args) {
        //打印100~150之间所有的质数
        //质数是指在大于1的自然数中, 除了1和它本身以外不再有其他因数的自然数
        int count = 0;
        
        //不建议使用!!!
        outer: for (int i=101; i<150; i++){
            for (int j=2; j<i/2; j++){
                if ((i%j == 0)) {
                    continue outer;
                }
            }
            System.out.print(i+" ");
        }
    }
}

 

posted @ 2021-09-20 11:06  Ahao丷  阅读(37)  评论(0)    收藏  举报