fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int count, n = 13;
  6. //cout << "Nhập n: " << endl;
  7.  
  8. //cin >> n;
  9. for(int i = 1; i <= n; i++)
  10. {
  11. if(n % i == 0)
  12. {
  13. count++;
  14. }
  15. else
  16. continue;
  17. }
  18. if(count == 2)
  19. cout << n << " là số nguyên tố." << endl;
  20. else
  21. cout << n << " không là số nguyên tố." << endl;
  22.  
  23. }
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
Standard output is empty