22199 数位之和
数位之和
https://ac.nowcoder.com/acm/problem/22199
#include<iostream> using namespace std; int main() { int a, b=0; cin>>a; while(a>=1) { b=b+a%10; a=a/10; } cout<<b; return 0; }
%和/不要记反了
数位之和
https://ac.nowcoder.com/acm/problem/22199
#include<iostream> using namespace std; int main() { int a, b=0; cin>>a; while(a>=1) { b=b+a%10; a=a/10; } cout<<b; return 0; }
%和/不要记反了
相关推荐