Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
91
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.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     unsigned int n, p=1, d, nd;
  8.     cin >> n;
  9.     while(n!=0)
  10.     {
  11.         nd = 0;
  12.         d = 1;
  13.         while(d<=p)
  14.         {
  15.             if(p%d==0)
  16.             {
  17.                 nd = nd + 1;
  18.             }
  19.             d = d + 1;
  20.  
  21.         }
  22.         if(nd==2)
  23.         {
  24.              n = n -1;
  25.              cout << p << "\n";
  26.         }
  27.  
  28.         p = p + 1;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement