- 20260112-初级班-期末测试
3
- @ 2026-1-12 16:31:48
#include
using namespace std;
int main(){
int x;
cin >> x;
int count = 0;
if(x == 0){
cout << 1 << endl;
return 0;
}
while(x > 0){
int digit = x % 10;
if(digit % 2 == 0){
count++;
}
x = x / 10;
}
cout << count << endl;
return 0;
}
1 条评论
-
楼嘉树 LV 6 @ 2026-1-12 16:53:10
#include
using namespace std;
int main(){
int x;
cin >> x;
int count = 0;
if(x == 0){
cout << 1 << endl;
return 0;
}
while(x > 0){
int digit = x % 10;
if(digit % 2 == 0){
count++;
}
x = x / 10;
}
cout << count << endl;
return 0;
}dghj
- 1