title: why % operator can not be used for float in C/C++ but can be used in Java and C#?
body: <p>Consider following program in C++:</p>
  
  <pre><code>#include &lt;iostream&gt;
  int main()
  {
      float f = 9.9f, m = 3.3f;
      float c = f % m;  
      std::cout &lt;&lt; c;
      return 0;
  }
  </code></pre>
  
  <p>Shows an error: <code>Illegal use of floating point</code></p>
  
  <p>When I write same program in Java like:</p>
  
  <pre><code>class Test
  {
      public static void main(String args[])
      {
          float f = 9.9f, m = 3.3f;
          float c = f % m;
          System.out.println(c);
      }
  }
  </code></pre>
  
  <p>Gives me the output: <code>3.2999997</code></p>
  
  <p>and also in C#:</p>
  
  <pre><code>using System;
  class Test
  {
      public static void Main()
      {
          float f = 9.9f, m = 3.3f;
          float c = f % m;
          Console.WriteLine(c);
      }
  }
  </code></pre>
  
  <p>gives output: <code>3.3</code></p>
  
  <p>Why the same programming logic gives three different outputs in different language? Why we can't use <code>modulo %</code> with floating point numbers in C/C++ but can use in Java and C#?</p>
  
  <p>Sorry if it is a fool question...I am a student...thanks.</p>