'Write an algorithm to find the position of highlighter before every every button press if the button must be pressed N number of times in an exercise

for the e-learning, various tutorials are provided to the students. one of the tutorials shows the highlighter on a number A on the number lin. there is a "jump" button in the tutorial. on pressing the "jump button, the highlighter moves by a fixed number D towards the right side if D is positive and towards the left dide if D is negative. The student has to press the button N number of times. the tutorial has various sets of exercise, the positions of the highlighter before press will be stored in the database. write a program in c to find the position of the highlighter before every button press if the button must be presses N number of times in an exercise



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source