Let the oxidation state of chlorine be x an y in HClO4 and HClO3.
The oxidation number of H and O atoms in both HClO4 and HClO3 are +1 and −2 respectively.
HClO4:
Let the oxidation number of Cl is x
+1+x×(−8)=0x=8−1x=+7
HClO3:
Let the oxidation number of Cl is y
+1+y×(−6)=0y=6−1y=+5.
Difference : x−y=7−5=2