I am trying to convert UTM to a latlong point. To get that done I need to know the zone where the UTM coordinates are. how can I find the zone from UTM?. the place coordinates that I work on lay on zone 39 and 40.
In general, you cannot determine the zone from the coordinates: that's why the zone is needed!
In your case, though, it sounds like you are looking within a small area that straddles neighboring zones. In that case, locations in zone 39 will have large positive x-values and locations in zone 40 will have negative or small positive x-values: that's how you can tell them apart. This approach will work provided your area does not extend more than six degrees in longitude from east to west (the width of one zone). (In general, compute the longitude using both zone options and choose the one that falls within your area of interest.)