title: Program to generate nth prime number
body: <pre><code>#include&lt;iostream.h&gt;
  #include&lt;conio.h&gt;
  #include&lt;stdio.h&gt;
  main()
  {
  clrscr();
  int num,b,c,d,f,primeset[500],j=0;
  cout&lt;&lt;"Enter Number (n): ";
  cin&gt;&gt;num;
  primeset[0]=2;
  for(b=3;b&lt;=1000;b++)
  {
  
      for(c=2;c&lt;b;c++)
      {
          d=b%c;
          if(d==0)
          {
              j=1;break;
          }
          else
          {
              j=0;
          }
      }
  
      if(j==0)
      {
          for(f=1;f&lt;500;f++)
          {
              primeset[f]=b;
          }
      }
      else
      {
      //do nothing
      }
      }
      cout&lt;&lt;"n th Prime is "&lt;&lt;primeset[num-1];
      getch();
      return 0;
      }
  </code></pre>
  
  <p>This is my program to find the nth prime, but it does not work, please hep me.
  please tell me about my errors.
   please tell me, why my program is not working, its giving 2 for num=1 and 997 for all other values of num. tell me the errors and the code to fix them.
  PS:I use turbo c++</p>