When the letter “X” is in the middle of a word, it is pronounced in one of two ways. It is pronounced as /KS/ or /GZ/. Here is a rule to determine how to say “X” in a word.
If the “X” comes between two vowels say /GZ/. If the “X” comes between a vowel and a consonant then say /KS/. Here are some examples:
“X” pronounced /GZ/: exit, exude, exam
“X” pronounced as /KS/: extreme, extra, expert