int a[10], count = 0;;
for (int i = 0; i < 10; i++)
{
cout << "a" << "[" << i << "] = ";
cin >> a[i];
}
cout << endl;
for (int k = 0; k < 10; k++)
{
for (int i = 1; i <= a[k]; i++)
{
if (a[k] % i == 0)
{
count++;
}
}
if (count == 2)
{
cout <<a[k] << ": Prime Number" << endl;
count = 0;
}
else
{
cout <<a[k] << ": Not a Prime Number" << endl;
count = 0;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น