I didnt use abs function, so i attached it for fulfillment of conditions. So code works properly why it says output wrong