Why Does A Float Variable Stop Incrementing At Number #20
Why does a float variable stop incrementing at number ‘16777216’ in the following C# code?</p> <pre><code class="language-csharp" line="1"> float a = 0 ; while (true) { a++; if (a > 16777216) break; } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs108 CSharp. It can also be found in gs gs108 Data Types, Variables and Operators - Floating and Decimal Data Types - Quiz No.1.
Why does a float variable stop incrementing at number ‘16777216’ in the following C# code?
float a = 0 ; while (true) { a++; if (a > 16777216) break; }
Sign and Exponent for ‘16777217’ is same as for ‘16777216’
Mantissa is different for ‘16777216’ and ‘16777217’
Sign and Exponent for ‘16777217’ is different from ‘16777216’
None of the mentioned