optimisation of the prime number program
<p>I have written a simple prime number generator program the thing is working perfectly 
but can you people help me in optimising my program without making nay major changes in my program 
intitially <code>t</code> signifies test cases, <code>x</code>  and <code>y</code> indicates where we have to start and end printing prime numbers from   for example <code>t=1,x=1,y=10</code>, output is <code>2 3 5 7</code> </p>

<pre><code>#include&lt;iostream.h&gt;
#include&lt;conio.h&gt;
int main()
{
    clrscr();
    int t;
    cin&gt;&gt;t;
    int x,y;
    while(t&gt;0)
    {
        cin&gt;&gt;x&gt;&gt;y;
        if((x&lt;=2)&amp;&amp;(y&gt;3))
           cout&lt;&lt;"2\n"&lt;&lt;"3\n";
        else if(y&gt;=3)
           cout&lt;&lt;"3\n";
        for(int i=x;i&lt;=y;i++)
        {
          int k=0,d=2;
          while(d&lt;=i/2)
          {
              k=i%d; 
              if(k==0)
                 break;
              else
                 d++; 
          }
          if(k==1)
              cout&lt;&lt;i&lt;&lt;"\n";
         }
         t--;
     }
   return 0;
 }
</code></pre>
