Given a variable
 
float num;
 
How it should be initialized so that the following code
 
if (num == num) 
    Console.WriteLine("Equal"); 
else 
    Console.WriteLine("Not equal");
 
Returns
  Not equal
Explanation
0 / 0.0F operator produces a NAN result (not a number), Thus the (num == num) expression can not be considered from a logical point of view

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback