Example of C progamming language
Try this in turbo C:-
float a=0.7;
if(0.7>a)
printf("aa");
else
printf("bb");
getch();
}
Output : aa
The if statement goes for true part but why...??
Answer for this that 0.7 is stored in the memory as 0.699999988079071.
Therefore if statement goes for true part.
Check another example by typing this small code :
float a=0.3;
printf("%.20f",a);
getch();
}
You will get output as : 0.29999999999999998890
Here 0.3 is stored as 0.29999999999999998890 in the memory
#include<stdio.h>
#include<conio.h>
void main()
{#include<conio.h>
void main()
float a=0.7;
if(0.7>a)
printf("aa");
else
printf("bb");
getch();
}
Output : aa
The if statement goes for true part but why...??
Answer for this that 0.7 is stored in the memory as 0.699999988079071.
Therefore if statement goes for true part.
Check another example by typing this small code :
#include<stdio.h>
#include<conio.h>
void main()
{#include<conio.h>
void main()
float a=0.3;
printf("%.20f",a);
getch();
}
You will get output as : 0.29999999999999998890
Here 0.3 is stored as 0.29999999999999998890 in the memory
0 comments: