An exact r-coloring of a set S is a surjective function c:S→[r]. The rainbow number of a set S for equation eq is the smallest integer r such that every exact r-coloring of S contains a rainbow solution to eq. In this paper, the rainbow number of Zp, for p prime and the equation a1x1+a2x2+a3x3=b is determined. The rainbow number of Zn, for a natural number n, is determined under certain conditions.