打印1-100之间的素数 C++实现

打印1-100之间的素数
素数:除了1和它本身之外不能被其他数整除

/*        1-100素数
#include<iostream>
#include<math.h>  
using namespace std;
void main()
{
    int i;
    for (i=2; i <=100; i++)
    {
        int j = 2;
        for (; j<i; j++)
        {
            if (i%j == 0)
                break;
        }
        if (j>=i)
        {
            cout << i << endl;
        }
    }
    cout << "\n "<< endl;
}*/

这里写图片描述

猜你喜欢

转载自blog.csdn.net/yu876876/article/details/79548830