Initialize the salary at 1 and, each time through some look that runs 'days' times, double it.
Or you could just use 1 << (n - 1) to compute the amount paid on the nth day, or (1 << n) - 1 will give you the cumulative amount paid after n days.
Reputation Points: 1133
Solved Threads: 171
Super Senior Demiposter
Offline 2,478 posts
since Jun 2005