Share the printer on computer A
Then on computer B go to networking and find the shared printer and print to it
There may be some differing details depending on if you are home networking, workgroup networking or domain networking though. Also some more steps if the machines were different OSes (I.e one XP and one 7)