there are 12 friends. each greeted each other by shaking hands. how many handshakes took place.


What that tells me is that you do not know what the "principle of counting" is! No, it does not mean "write out all the possible handshakes and count them up".
There are 12 friends and each shakes hands with each of the 11 others. The "principle of counting" says there are 12*11 "handshakes". But that counts the handshake between "Andy" and "Barbara" twice- once for Andy and once for Barbara. So, as BAdhi says, divide by 2.