It's elementary. Just use зачем as you do "what for" and почему as you do "why".