there are many approach with that kind of problem.
The first approach that I thought is:
I have int var = 1; int answer = 0;
then I'll get the first digit, and multiply it by var.
and then I'll...