How is it same in the first one 3 particles are in the upper layer and 3 in the lower layer while in second case 4 particles are in one layer....
I'm not sure if this is right or even relevant ... but here goes ...
You are trying to draw conclusions about the ratio of particles in the structure, but you are selecting different "subsets" of the particles or different "views" of the packing between the ions.
This is understandable because you want to make the problem as simple as possible and hence be able to see any patterns or numerical relationship between the ions.
What you need to find is the "repeating unit" in this structure
Now, I'm assuming you are looking at a cubical structure. The packing can be described as layers of atoms in a hexagonal arrangement (*). There are two packing types face centred cubic and body-centred cubic. The difference is in the relationship of the position of 3rd layer to the first layer. We can describe the layers as (1) ABABAB ... and (2) ABCABCABC ...
I have created a diagram that tries to show this difference.
However, the density of packing of both schemes is identical.
So ... is any of that relevant to your question? I think somehow ( and I don't know how) you need to find the "repeating unit" in your structure and work with that by taking ratio of the volume of the "enclosing cube" to the volume occupied by spheres. The immediate problem is where the boundary for the "enclosing cube" lies - that I can't work out.
Clive
(*) This relationship between hexagonal packing and cubic crystals I find most difficult to understand. I guess interpretation of crystal shape is a university subject because of the maths involved.