i have two different programs that compare float and double variales and gives output , i shown that below :
1.
#include<stdio.h>
main()
{
int r;
float f=22.5;
double d=22.5;
r=(f==d);
printf("r=%d",r);
}
Output:-
r=1
2.
#include<stdio.h>
main()
{
int r;
float f=22.7;
double d=22.7;
r=(f==d);
printf("r=%d",r);
}
Output:-
r=0
why this happen that for 22.5 both are same and gives o/p 1 and 22.7 both (f & d) are different and gives o/p 0