Its hard to know how to answer your question, just as is stated.
If someone tells you 'KCl' or 'H2SO4', then you can simply count the formula. You gave us the formulas, so I don't know if that is the issue.
If someone says sodium chloride, or phosphoric acid, then you're expected to have memorized at least some of the elements of the periodic table, and what the position of the elements in the periodic table mean, so you can predict the formula. And also we start to remember them after a while.
Can you tell us what you have you learned, recently, in class, or read, recently, in a textbook to let us know what your source of confusion is?