It has been solved
Last edited on
is a very specific word that I don't think you meant to use here. If it is... you didn't use the
keyword so it won't return 2.
Otherwise, you aren't decrementing a by 0.5 every iteration of the while loop, you are just calculating a/2 and not doing anything with it.
I think what you meant to do is:
using namespace std ;
a/=2; // a = a/2;
Also keep in mind that when declaring a variable as
, you introduce floating point errors. Using
, will keep this minimized and you'll certainly output
2 each time.
Topic archived. No new replies allowed.