#5913: 當我把while加入就出問題


ABC3286221 (博丞)


#include<iostream>

using namespace std;

int main()
{
int a,b;
int mark=1;

                        
while(cin>>a)
{  
for(b=2;b<a;b++)  
if(a%b==0)mark=0;

if(mark==0)                
cout<<"非質數"<<endl;
else
cout<<"質數"<<endl;

}

return 0 ;
}
 

當我加入while 程式就亂掉了 不知道怎麼回事 我找不出我哪裡錯誤

請告訴我解決方法 各位資深人士