What Richard said in Solution 1 is correct. I assume, you have "found" the code somewhere and the original author was in the process of refactoring the code into several independent functions. You caught it right in the middle of things :-)
Regarding the algorithm, there are several things that can't work:
n1 = originalnumber / 100;
n2 = (originalnumber % 100) / 100;
n3 = originalnumber % 10;
Obviously, n1 to n3 should receive the digits of a three-digit decimal number. In that case the second statement needs to be:
n2 = (originalnumber % 100) / 10;
In the next section you want to modify each of the digits by the key. But for the following code to work, this modification must remain in the range of 0 ... 9. Hence that section should read:
n1 = (n1 + key) % 10;
n2 = (n2 + key) % 10;
n3 = (n3 + key) % 10;
And lastly, exchanging the values of two variables cannot be done by:
n1 = n3;
n3 = n1;
All that does is to assign to value of n3 to both, n3 and n1. It should probably read:
int temp = n1;
n1 = n3;
n3 = temp;