For the protons, the charge on proton is +<?.
If the number of up quarks are a, then the number of down quarks are (3 - a) as the total number of quarks are 3. So, a x up quark charge + (3 — a) down quark charge) = +e
a x 2/3 e + (3-a) -e/3 = e
2ae/3 - (3-a)e/3 = e
2a-3+a = 3
3a = 6
a = 2
Thus, in the proton, there are two up quarks and one down quark.
Possible quark composition for proton = uud For the neutron, the charge on neutron is 0.
Let the number of up quarks be b and the number of down quarks be 3-b.
So, b x up quark charge + (3 — b) down quark charge = 0
b(2e/3) + (3-b)(-e/3) = 0
2b-3+b = 0
3b = 3
Thus, in neutron, there is one up quark and two down quarks.
Possible quark composition for neutron = udd