How to change the parameter value dynamically during execution?

Example : I have variable named counter = 1 , during run time I need to change the value as 1+1=2.
i.e, current value = previous value (+/- ) N

Basically, would like to perform arithmetic operations on the parameters / some value fetched from the web page.

Please guide me.