-
What will be the output of the following C code?
#include <stdio.h>
int main()
{
float num1 = 0.2;
if (num1 == 0.2)
{
printf("Equal\n");
}
else
{
printf("Not Equal\n");
}
}
-
- Compilation Error
- 0.2
- Equal
- Not Equal
- None of these
Correct Option: D
0.2 by default is of type double which has different representation than float resulting in inequality even after conversion.