35657

Untitled

Nov 11th, 2023
748
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.    
  8.     for (int i = 2; i <= 1000; i++) {
  9.         int j = 2;
  10.         for (; j < i; j++) {
  11.             if (i % j == 0) {
  12.                 break;
  13.             }
  14.         }
  15.         if (i == j) {
  16.             cout << i << " ";
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment