Crutoy37
Coder
Hi everyone. I am self-studying C from a book C How to program and came upon assignment that requires you to encrypt a four-digit integer. The requirements are as follows: Replace each digit with result of adding a 7 to the digit and getting a remainder by dividing by 10. Then swap first digit with third, and fourth digit with second. I am not sure yet how I will change the digits places but I think I can solve the first part. I would break down the number in each separate digit and do the arithmetic manipulation and then would have to multiply each number into appropriate power to bring it back as a whole. To swap the numbers, do I just break the number up and store each digit in a separate variable ? The course only covered so far while loop, if, else if statements. Just looking for suggestions on how to solve the swapping digits part. Thanks for your time.