return挺好用的
#include<iostream>
#include<string.h>
using namespace std;
int n;
int judge(int x)
{
for (int i = 2; i < x; i++)
{
if (x % 2 == 0)
return 0;
}
return 1;
}
int main()
{
scanf_s("%d", &n);
for (int j = 2; j <= n / 2; j++)
{
if (n % j == 0)
{
if (judge(j))
printf_s("%d ", j);
}
}
if (judge(n))
printf_s("%d ", n);
return 0;
}