Float comparison are not recomended in C++ better try the following condition.
If( abs( a- 11.202 ) <= 1.e6 )
This will solve your problem.
Sent from my iPod
On Feb 7, 2011, at 8:22 PM, ankit agarwal wrote:
> #include
>
> int main()
> {
> float a=11.202;
> if(a<11.202)
> prin
But is the bug in the given program
On Mon, Feb 7, 2011 at 8:32 PM, Shalini Sah wrote:
> try dis :
>
> #include
> int main()
> {
> float a=11.202;
> if((a-11.202)==0)
>
> printf("Hiii!!!\n");
> else
> printf("Hello!!!\n");
> return 0;
> }
> you will
try dis :
#include
int main()
{
float a=11.202;
if((a-11.202)==0)
printf("Hiii!!!\n");
else
printf("Hello!!!\n");
return 0;
}
you will get :
Hello!!!
On Mon, Feb 7, 2011 at 8:22 PM, ankit agarwal wrote:
> #include
>
> int main()
> {
> float a=11.202;
>
#include
int main()
{
float a=11.202;
if(a<11.202)
printf("Hiii!!!\n");
else
printf("Hello!!!\n");
return 0;
}
output: Hiii!!!
why does this output comes???
Ankit Agarwal
--
You received this message because you are subscribed to the Google Groups
"Algorithm