wangbinyuan @ 2023-03-26 10:56:33
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
long long num, flag = 0;
cin >> num;
if(num == 0)
{
cout << num;
return 0;
}
if(num < 0)
{
flag = 1;
num = abs(num);
cout << "-";
}
while(num > 0)
{
if(num % 10 != 0)
{
cout << num % 10;
}
num /= 10;
}
return 0;
}
by fwtv_24 @ 2023-03-26 11:31:11
while部分可以改一下
while(num!=0)
{
ans=ans*10+num%10;
num/=10
}
cout<<ans;
by wangbinyuan @ 2023-03-26 13:47:12
谢谢
by xawuyulun @ 2023-04-02 15:21:27
#include<iostream>
using namespace std;
int main(){
int n,f=0; //f 反转数
cin>>n;
while(n!=0){
f=f*10+n%10;
n=n/10;
}
cout<<f;
return 0;
}
by a1915825705 @ 2023-05-25 12:00:02
@xawuyulun 简单易懂 tql