I don't know under what category to classify this question.

I have say 17 variables in a HTML page, now they all start with "ans" and have the format "ans1", "ans2", "ans3"....

I want to read these variables (and perform certain operations) one by one in a single while loop. How can it be done? I have tried various methods but nothing seems to be working.

I want something like $ans$c where c is incremented.

Thx.