Quote:
Q. There is a city where a person never ages more then 40. Once you reach 40, your age starts decreasing i.e. 39,38,37....10. Once you reached 10, your age will increase again i.e 11,12,13....40. This goes for infinite times.
This describe a situation, but as there is no question, so there is no algorithm to solve the non question.
Quote:
I can not figure out algorithm
Take a sheet of paper and pencil and try to solve your problem by hand, the provedure you follow is your algorithm.