NO 1 : float extra=(((d*50)/1000)/t)*3600 and NO 2 : float extra=d*180/t; WHEN I USE NO2 ANS IS CORRECT AND WHEN I USE NO1 ANS IS WRONG || PLEASE EXPLAIN||

PLEASE EXPLAIN TO UNDERSTAND THIS .

In the first case, when you are dividing d*50 by 1000, its doing an integer division and returns ans in integer. To correct it, just do 1000.0 and it will be correct

1 Like

Thanks a lot Sir :smile: :v: