微稂_小哥 @ 2017-08-01 11:49:15
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int a[20]={0};
int i,n,n1,k,j,m,sum;
float z;
k=1;sum=0;
scanf("%d",&n);
if(n<0)
n1=abs(n);
else
n1=n;
for(i=10;i<n1*10;i=i*10)
{
a[k]=n1%i;
a[k]=(a[k]-a[k-1])/(i/10);
k++;
}
for(m=1;m<=k+m;m++)
{
z=pow(10,k-2)*a[m];
sum=sum+z;
--k;
}
if(n<0)
{
printf("%d",-sum);
}
else if(n==0)
{
printf("0");
}
else
{
printf("%d",sum);
}
return 0;
}
by 我至高的爷爷 @ 2017-09-20 14:22:49
Sb