Quote Originally Posted by Ozlem Kayra View Post
here it is finally working fine but I am still not sure how this flag works. I mean how copiler process this flag?
That is precisely why I was hoping that you would be told to go away and think about it instead of being given the answer. This kind of logic problem is really simple and if you fail to come to the answer to it on your own then you're only going to fail further when it comes to moderately harder logic problems.
Until you can solve this kind of problem on your own, you're not meant to be a programmer.