The code is able to give output correctly and it is also a infinite loop which means user can enter multiple values and still get the desired output. Alas, it fails to fail to satisfy the conditions mentioned. why?