Page variable update

Hello
I am trying to build a quiz app. in that app one of the page is question display page. The page looks like as shown below.


can someone help me how to update (increment by 1) the variable (X is the variable name which is a question number) when i press the next button and decrement by 1 when i press previous button.