title: Read only floating numbers and reject integer and characters (a.b,c etc.) until correct
body: <p>I am trying to write a code in C (gcc) to accept only floating numbers  and reject integers, special characters, alphanumeric entries.</p>
  
  <p>I want it to see if <code>printf("First number: \n");</code> &amp; <code>printf("Second number: \n");</code> are floating numbers with decimals otherwise ask the user to re-enter a floating number since his first input was invalid.</p>
  
  <p>I want that to happen before it starts calculating.
  I need a code expample if possible</p>
  
  <pre><code>#include  &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt; 
  
  
  int  main(void)
  {
     setvbuf(stdout, NULL, _IONBF, 0);
     setvbuf(stderr, NULL, _IONBF, 0);
  
     float a, b, sm;
     int i = 2;
  
  
  
     printf("First number: \n");
     scanf("%f", &amp;a);
  
  
     printf("Second number: \n");
     scanf("%f", &amp;b);
  
  
     printf ("%.2f + %.2f = %.2f -&gt; Summe \n", a, b, sm = a+b); 
     printf ("%.2f / %d = %.2f -&gt; Mittelwert \n", sm, i, sm/i); 
     printf ("%.2f - %.2f = %.2f -&gt; Differenz \n", a, b, a-b); 
     printf ("%.2f * %.2f = %.2f -&gt; Produkt \n", a, b, a*b);  
     printf ("%.2f / %.2f = %.2f -&gt; Division\n", a, b, a/b); 
  
  
  
  
  
  }
  
  </code></pre>
  
  <p>Thank you for your time!</p>