Create an array (say
int a[]
) mapping input (the
index of the array item) to the output (the
value of the array item).
Then, for each input
i
you produce the output
a[i]
.
[update]
It is really simple (bound checking left to the reader).
int output(int input)
{
static int a[] = {1,2,3,4,5,6,7,8,9,1,0,1,1,1,2,1,3,1,4};
return a[input];
}
[/update]