+ 2
#include <stdio.h> void main() { float x = 0.1; if (x == 0.1) printf("Sanfoundry"); else printf("Advanced C Classes"); }
The o/p is "Advanced c classes " How ??
3 RĂ©ponses
+ 5
đžđđđ„đđ đđđđ
What âłAsterisKâł said is right and if you desire to get the output as "Sanfoundry", please make sure the condition inside if is "x==0.1f"
#include <stdio.h>
int main()
{
float x = 0.1;
if (x == 0.1f)
printf("Sanfoundry");
else
printf("Advanced C Classes");
return 0;
}
+ 3
x is float while just writing 0.1 is a double, hence the reason precision make em different
0
I got it.
Thanks both of you.đ