wsqgh @ 2023-01-11 10:57:56
``
using namespace std;
int main() { long long N; int a,last; cin >> N; if(N==0) cout << 0 << endl;
if(N>0) {
while(N) {
a=N%10;
if(a!=0)
printf("%d",a);
N=N/10;
}
}
if(N<0) {
cout<<'-';
N=-N;
while(N) {
a=N%10;
if(a!=0)
printf("%d",a);
N=N/10;
}
}
return 0;
}
by zzzzl22 @ 2023-01-18 15:28:06
不是不等于0,是首个数字不能为0
by zzzzl22 @ 2023-01-18 15:42:20
比如这样
if(i!=0||n%10!=0){
cout<<n%10;
i++;
}