This one is a tad hard to answer, as it is highly dependent on the type sub, the year and other variables. Basic rule of thumb, 4 Officers, 0-2 Cadets (especially in later years), 1 PO for every 2 Enlisted. Top 4 PO are CPO. That is a general rule - for more realistic crews, I use:
http://www.ubootwaffe.net/
to look up a specific ship, then convert her crew to SH3 terms. I use the crew listed as on board when lost, as that gives a good snapshot of the type/year/flotilla I am simulating for that career.