'commit'
This commit is contained in:
16
C++课程/第十七课一维数组/tmp_t_count.cpp
Normal file
16
C++课程/第十七课一维数组/tmp_t_count.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n=0,ans=0;
|
||||
cin >>n;
|
||||
int tmp=n;
|
||||
while(tmp>=1) {
|
||||
if(tmp%10==2) ans++;
|
||||
tmp/=10;
|
||||
}
|
||||
cout<<ans;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user