#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    int i, j;
    int a[101] = { 0 };
    for (i = 2; i <= 100;i++)
    {
        for (j = 2; j <= sqrt(i);j++)
            if (i%j==0)
                break;
        if (j >= sqrt(i))
            a[i] = 1;
    }

    for (i = 1; i <= 100; i++)
        if (a[i])
            printf("%d ", i);
    system("pause");
    return 0;
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
  • 2021-08-03
  • 2021-07-16
猜你喜欢
  • 2021-11-16
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
相关资源
相似解决方案