Calculate the formula of a compound which has composition. MaMagnesium 9.8%,sulphur 13%, oxygen 26%,water of crystallization 51%. (Mg=24,S=32,O=16,H2O=18g/mol)

assume 100 grams

Mg 24 grams, ....

Next convert each mass to moles:
Mg=24/24=about 1 mole (do it accurately).

Next, for each of the elments, and water, divide the moles of each by the lowest moles of any element (or water).

The remaining numbers are the mole ratio in the compound
MgaSbOc.DH2O
so a,b, c and d have to be whole numbers....