This problem is very easy to answer. You simply have to look at the subscripts of each element of the compound.
1. For caffeine, which has a molecular formula of C₈H₁₀N₄O₂, it contains 8 atoms of Carbon, 10 atoms of Hydrogen, 4 atoms of Nitrogen and 2 atoms of Oxygen.
2. For Iron(III) Sulfate, which has a molecular formula of Fe₂(SO₄)₃, it contains 2 atoms of Iron, 3 atoms of Sulfur, and 12 atoms of Oxygen.
Lithium is atomic number 3, so it has valency 1
While, Bromine is atomic number 35, and has valency 1
Lithium has an extra electron while Bromine need an electron, since they both need and have one electron, the form
LiBr (Lithium Bromide) where Li is +ve charged and Br is -ve charged
Happy to help :)