#include<stdio.h>
#include<string.h>
#include<iostream>
#include<time.h>
using namespace std;
int chose(int s)
{
int i = 2;
do {
if (s % i == 0 && s != i || s == 1)
return 0;
i++;
} while (i < s);
return 1;
}
int main()
{
int a[10], b, c;
for (int i = 0; i < 10; i++)
scanf_s("%d", &a[i]);
for (int i = 0; i < 10; i++)
{
c = chose(a[i]);
if (c == 1)printf("%-5d", a[i]);
}
return 0;
}
输入十个整数,输出其中质数
最新推荐文章于 2022-12-16 19:27:47 发布