35657

Untitled

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