Like charges repel and unlike charges attract .
Everyone will tell this but none to explain.
See,for this u have to understand some terms and theories.
A quark is a fundamental particle which can not be further be divided or are simply indivisible particle. When the three valence quarks combined with a strong nuclear force together form a hadron.And when two up quarks having charge +2/3 charge each and one down quark having charge -1/3 charge.
So, proton = Two up quarks and one down quark=(2/3+2/3-1/3)=+1 charge
And an electron is indivisible particle having charge -1 or it assumed that it is made up of two down quarks and one up quark.
So it is a fundamentle law of Physics that every object or any body or simply anything wants to become stable in the as simplest way
So in an atom the electron is free and near an atom of one positive charge that is one proton greater than the number of electrons so the free electron which is roaming around to find the means to get discharged or to get stable it combines with the other electrons in that atom or ion to get neutralised or stable.Hence we can conclude that the number of quarks of up and down should be the same.
Or u can also understand this concept like this that,
When u do a mistake and u are guilty in the eyes of the people and they have a negative remark about u and suppose u have a acquired a negative charge so in order to remove that charge or the thinking about u in other people's mind u are wanting to do a good work or to get stable. And when u do good work people think good about u and u have acquired a positive charge which gets neutralised with negative one u were having.
I hope u have now understood !
U will study the qurk theory in class 12th or in B.tech or B.sc in detail about it.
There are many other particles also other than quarks like boson,meson,lepton,etc.
Plz mark as the best if u liked it !!