如何判断一个数的末尾是不是0呢?如果是则输出yes,不是则输出no。
对10取余数,如果为0,即末尾为0.
我的代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int a;
cin >> a;
if (a % 10 == 0) {
cout << "yes" << endl;
}else {
cout << "no" << endl;
}
return 0;
}
位运算
int a;
a=a<<31