jeudi 2 février 2017

Why does float give different outputs if we use it with if and 'equal to' operator? Please see the code below:

float f=2.2;
if (f==2.2)
printf("abc");
else
printf("xyz");

//this code prints xyz,while if we give 2.5 instead of 2.2 the output is abc.

Aucun commentaire:

Enregistrer un commentaire