本题注意在数字中间也可能有0,例如:40206030
#include<iostream>
#include<cstring>
using namespace std;
int main(){
char c[12];
int i;
scanf("%s",c);
int len = strlen(c);
if(c[0] == '-'){
printf("-");
for(i = len-1; i > 0; i--)
if(c[i] == '0'){
len--;
continue;
}
else
break;
for(i = len-1; i > 0; i--)
printf("%c",c[i]);
}
else{
for(i = len-1; i >= 0; i--)
if(c[i] == '0'){
len--;
continue;
}
else
break;
for(i = len-1; i >= 0; i--)
printf("%c",c[i]);
}
return 0;
}