for A=1 to 30

what language are you writing in?

if C# then
if (a <= 30 && a >= 0)
to just determine if the number is within 0 - 30
are you looking for a "for" loop?