想請教這樣位甚麼會TLE
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int a;
bool p = true;//質數
while (cin >> a)
{
for (int i = 2; i < a; i++)
{
if (a % i !=0)
{
p = true;
}
else
{
p = false;
break;
}
}
if (p)
{
cout << "質數" << endl;
}
else
{
cout << "非質數" << endl;
}
}
}