Indian Penal Code, 1860
Where anything which is an offence is made up of parts, any of which parts is itself an offence, the offender shall not be punished with the punishment of more than one of such his offences, unless it be so expressly provided.
33[Where anything is an offence falling within two or more separate definitions of any law in force for the time being by which offences are defined or punished, or where several acts, of which one or more than one would by itself or themselves constitute an offence, constitute, when combined, a different offence, the offender shall not be punished with a more severe punishment than the court which tries him could award for any one of such offences.]
(a) A gives Z fifty strokes with a stick. Here A may have committed the offence of voluntarily causing hurt to Z by the whole beating, and also by each of the blows which make up the whole beating. If A were liable to punishment for every blow, he might be imprisoned for fifty years, one for each blow. But he is liable only to one punishment for the whole beating.
(b) But if, while A is beating Z, Y interferes, and A intentionally strikes Y, here, as the blow given to Y is no part of the act whereby A voluntarily causes hurt to Z, A is liable to one punishment for voluntarily causing hurt to Z, and to another for the blow given to Y.