title: smallest divisor of an integer without computing the square root explcitly
body: <p>This code gives the smallest divisor of an integer. But the problem is I have to calculate the square root. Is there a way so that I don't have to calculate the square root explicitly?</p>
  
  <pre><code>int d,r,n;
  scanf("%d",&amp;n);
  if(n%2==0)
  {
      printf("2 is ans"); 
  }
  else
  {
      r=sqrt(n);
      d=3;
      while((n%d!=0)&amp;&amp;d&lt;r)
      {
          d=d+2; 
      }
      if(n%d==0)
          printf("ans is %d",d);
      else
          printf("ans is 1");
  }
  </code></pre>