How If() function actually works. I got totally confused when I run these three program.Could any one explain me how these outputs are coming?
Program 1:
int main(void)
{
float a=4.2;
clrscr();
if(a==4.2)
printf("Equal");
else if(a<4.2)
printf("Less");
else if(a>4.2)
printf("Greater");
getch();
}
Output: Less
Program 2:
int main(void)
{
float a=3.2;
clrscr();
if(a==3.2)
printf("Equal");
else if(a<3.2)
printf("Less");
else if(a>3.2)
printf("Greater");
getch();
}
Output: Greater
Program 3:
int main(void)
{
float a=3.5;
clrscr();
if(a==3.5)
printf("Equal");
else if(a<3.5)
printf("Less");
else if(a>3.5)
printf("Greater");
getch();
}
Output: Equal