Do you want percentage composition by mass or number of atoms?
For mass, just find the total mass (add them together) and divide the amount of each element by this amount.
or by the amount of elements. You need to convert the mass to the amount of atoms it is. To do this, you divide by something called "molar mass". It basically is how much a mole of an atom/molecule weights and is the same as the atomic mass, exept in grams. Now that you know how many moles you have, do the same as with mass. A way to check this is by seeing what molecule it gives you. So if we look at the periodic table, you should see that Mg and N combines to form Ng3N2. So this is 60% (3/5) Mg and 40% (2/5) Nitrogen. Which are the same numbers I got when I tried to solve your question.
If you need more help, I suggest consulting google.