70分.........

P1307 [NOIP2011 普及组] 数字反转

m1895 @ 2021-04-10 09:08:00

#include<iostream>
using namespace std;
int n,m=0;
int main()
{
    cin>>n;
    if(n<0)
    {
        cout<<"-";
        n=-n;
    }
    if(n%10==0); n=n/10;
    while(n!=0)
    {
        int k=n%10;
        m=m*10+k;
        n=n/10;
    }
    cout<<m;
    return 0;
} 
大佬救命

by devans @ 2021-04-10 09:11:18

if(n%10==0); n=n/10;

为啥 if 后面有个 ;


by Withers @ 2021-04-10 09:13:17

if(n%10==0); n=n/10;,if后面多加了分号


by m1895 @ 2021-04-10 09:16:54

谢谢大佬


|