how to change postition of digits in an integer in c
<p>The problem is as follows: 
I need to write a function that takes a four digit integer and then encrypts the number in this manner: take each digit and replace it by (c + 7)% 10;
and then swap the first digit with the third and the second with the last digit;
and then returns the encrypted integer.
I have managed to write this much of code thus far:</p>

<pre><code>#include&lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#define N 100


int encrypt(int a){
  int n=0,i;
  for (i=0;i&lt;4;i++){
    n = a%10;
    a = a/10;
    n = (n+7)%10;
  }
}


void main()
{
  int a;
  printf("Enter the four digit integer: ");
  scanf("%d",&amp;a);
  encrypt(a);
}
</code></pre>

<p>I am getting correct output for the conversion but I have no idea how to swap the position of digits.</p>