1,155 views
1 votes
1 votes
#include<stdio.h>

int main()

{ Float x=0.5;

if(x==0.5)

Printf("if");

else if(x==0.5f)

Printf("else if");

}

Explain the code line by line .

1 Answer

0 votes
0 votes
The answer should be else if becAuse decimal numbers are by default double so 0.5 is considered as double well the initialization should be as float x = 0.5f though, But it won't give any error but comparison of x with 0.5 will return false and else if will be printed.

yea its true as its compiler dependent.
edited by

No related questions found