finding out fractions of ions(different valencies/charges) of an element in non-stoichiometric compounds Analysis shows that nickel oxide has the formula $Ni_{0.98}O_{1.00}$. What fractions of nickel exist as $Ni^{2+} $and $Ni^{3+}$?


What i did:

Let the number of $Ni^{2+}$ and $Ni^{3+}$ atoms be $x$ and $y$ respectively  

one  atom/ion of $Ni^{2+}$ satisfies one  $O^{2-}$ atom

$2 \over 3$ atom/ion of $Ni^{3+}$ one  $O^{2-}$  atom

and then i wrote down the equations:
$x + $$3 \over 2 $$y =1$  and  $x+y=0.98$

Then i solved the equations to get the answers:

$x=0.94 $  $and$ $y=0.04$

Is what i did correct? If not then guide me how to solve the question
What you have done seems to be correct. But you might want to convert those numbers to percentiles. I can tell you another method based on charge conservation.
Let us take  100 oxygen atoms and 98 Nickel atoms into our consideration.
Total negative charge$= 200$
Total positive charge$= 2x+3y$ where $x$ and $y$ are what you have assumed to be in the question . Now Net charge =0.Equate the positive and negative charges.
Also $x+y=98$. Solve them and you will get the same number. This of course has an high degree of
similarity to what you have done