Advertisement
yejolga

ol_4_07

Nov 1st, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. //#include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9.     //ifstream cin("input.txt");
  10.     short n;
  11.     cin>>n;
  12.  
  13.     short i = 1;
  14.     long cur = 2;
  15.     while(i!=n)
  16.     {
  17.         cur++;
  18.         bool a = true;
  19.         for (long j=2; j<cur; j++)
  20.             if (cur%j==0)
  21.             {
  22.                 a = false;
  23.                 break;
  24.             }
  25.         if (a)
  26.             i++;
  27.     }
  28.     cout<<cur;
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement