Assuming you are working in decimal base, and you want to calculate X mod Y, you can do something like this:
1. mod = 0;
2. mod = ((mod * 10) + mostCignificantDigit)%Y;
3. remove the mostCignificantDigit from your number, and return to 2.
In other words, say you have the number in digit array A:
mod = 0;
for (int index = 0; index < A.size(); ++index)
mod = ((mod*10)+A[index]) %Y