title: C - How to check if the number is integer or float?
body: <p>Exercise 30<br>
  Write a program which reads float value developed as decimal extension and</p>
  
  <ul>
  <li>If it's integer, it says that it's integer</li>
  <li>on the other hand it rounds it to integer and writes the result.</li>
  </ul>
  
  <p>Remember about data control</p>
  
  <p>Here's the new one without this message about integer type. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  int main(){
      double x;              //the argument of f(x)
      printf("Program demands x");
      printf("\nand writes the rounded value\n");
      printf("Author: xXx\n\n");
                            //loading data
      printf("Write x in float type in decimal extension  "); // after many tries, program is not rounding the value
      if (scanf("%lf",&amp;x)!=1 || getchar()!='\n'){
          printf("Wrong data.\n");
          printf("\nEnd of program.\n");
          return 0;     
      }
      double round( double x );
      printf( "Rounded value is = %lf\n", x);
      printf("\nEnd of program.\n");
      return 0;   
  }
  </code></pre>