title: How to check if the value stored in a variable is integer or not in c. For example, we have something like Integer.tryparse in C#, something like that
body: <p>I want to check if the value stored in a float type variable is actually an integer, so that i can cast it to an integer type without losing data precision.</p>
  
  <p>my code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  #include &lt;math.h&gt;
  
  int main
  
  {
  
      int n;
      scanf("%d", &amp;n);
      double i = log(n);
      while( i is not an integer)
      {
          printf("\n Enter another number");
          scanf("%d", &amp;n);
          i = log(n);
      }
      return 0;
  }  
  </code></pre>