Please explain why the following pieces of code behave differently.
#include
int main(){
float a=0.1;
if(a<0.1)
printf(\"less\");
else
I would recommend you reading What Every Computer Scientist Should Know About Floating-Point Arithmetic. Basically when working with floating point numbers you should always check if a number is equal, smaller than or greater than some other number given some precision (epsilon) that you have defined.