返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5. re:
  6. int a,b=0;

  7. cout<<"***天才兒童的質數製造機***"<<endl;
  8. cout<<"請輸入數字:";
  9. cin>>a;

  10. for(int i=1;i<=a;i++){
  11.     if(a%i==0){

  12.         b+=1;
  13.     }
  14. }
  15. cout<<endl;
  16. if(b==2)
  17.     cout<<a<<"是質數"<<endl;
  18. else
  19. cout<<a<<"不是質數"<<endl;
  20. cout<<endl;
  21. goto re;



  22.     goto re;
  23.     system("pause");
  24.     return 0;
  25. }
複製代碼

TOP

返回列表