#include<iostream>
using namespace std;
int main()
{
int n,n1,p,c,i;
cout<<"n="; cin>>n;
n1=n;
c=0;
while(n>0)
{
c++;
n=n/10;
}
p=1;
for(i=1;i<=c/2;i++) p=p*10;
n=n1/(p*10)*p+n1%p;
cout<<n;
return 0;
}
sau
#include<iostream>
using namespace std;
int main()
{
int n,nr,r,x,i;
cout<<"n="; cin>>n;
nr=0;
x=n;
while(x>0)
{
nr++;
x=x/10;
}
r=0;
for(i=1;i<=nr/2;i++)
{
r=r*10+n%10;
n=n/10;
}
n=n/10;
while(r>0)
{
n=n*10+r%10;
r=r/10;
}
cout<<n;
}
|