oxidation number is defined as the total number of electrons that are gained or lost by the atom to form a chemical bond.
the oxidation number of the compound H₂S is 0.
the sum of the oxidation numbers of the individual elements should add up to the oxidation number of the compound.
(oxidation number of H x 2 H ions) + oxidation number of S = 0
since we know the oxidation number of H, lets name the oxidation number of S = x
(+1 * 2 )+ (x) = 0
2 + x = 0
x = -2
oxidation number of S is -2