main()
{
int i, s, p;
s = 10; /* first month */
for (i=2; i<=6; i++)
{
p = f(s); /* output of 2 ~ 6 */
s += p;
}
...
}
int f(int a)
{
/* the output of this month, a is the output last month */
return (a-2)*2;
}