I am diagnosed with ADHD inattentive type and good at math. Can I be a programmer?

Yes. Yes, yes, yes....Do not place any handicaps on yourself, you could be a good anything if you work hard at it, belief in yourself and enjoy what you do , and if you have adhd? Well take tour meds, practice task building skills and....Succeed!
Absolutely. Nothing about inattentive adhd by itself should stand in your way. Many with adhd, inattentive or combined, find it hard to organize complex tasks efficiently. Even if that is true for you, there are ways to breaking down tasks that should enable you to get the job done. Lots of people in inattentive adhd actually become hyperfocused when doing something they enjoy--like programming.For you.