int jiami(int a)
{
int r=0;
int[] aa = new int[4];
aa[0] = a / 1000;
aa[1] = a % 1000 / 100;
aa[2] = a % 100 / 10;
aa[3] = a % 10;
for (int i = 0; i < 4; i++) aa[i] = (aa[i] + 5) % 10;
r = aa[3] * 1000 + aa[2] * 100 + aa[1] * 10 + aa[0];
MessageBox.Show(r.ToString());
return r;
}
#include
int main()
{
printf("请输入一位四位整数:");
int y = 0;//1234
int a = 0;
int b = 0;
int c = 0;
int d = 0;
scanf("%d",&y);
a = y % 10;//4
y = y / 10;
b = a % 10;//3
y = y / 10;
c = b % 10;//2
y = y / 10;
d = c % 10;//1
int x = (a + 5) * 100 + (b + 5) * 10 + (c + 5) + (d + 5) / 10;
printf("加密后为:%d", x);
return 0;
}