竞赛
考级
#include <iostream> using namespace std; int main(){ int x,sum=0; cin>>x; while (x>0){ sum+=x%10; x/=10; } cout<<sum; return 0; }
不是小黑子
#include <bits/stdc++.h> using namespace std; int main(){ int a,n = 0; cin >> a; while(a > 0){ n += a % 10; a /= 10; } cout << n; }
红龙一斗
话不多说,上代码: 有用的话点个赞吧 官网:szy137.github.io
SZY2077 ด้้้้้็
法兰西玫瑰
majmDZB
Andy
#include <iostream> using namespace std; int main() { int n,sum=0; cin>>n; while(n>0){ sum+=n%10; n/=10; } cout<<sum; return 0; }
?
你猜
Creeper
寒香舞
#include <iostream> using namespace std; int main() { int a,c=0; cin>>a; while(a>0){ c+=a%10; a/=10; } cout<<c; return 0; }
WA战神姜禹卓
#include <bits/stdc++.h> using namespace std; int main(){ int x,a=0; cin>>x; while(x!=0){ a=a+x%10; x/=10; } cout<<a; return 0; }
张高纶
逍遥骇好=&
#include<iostream> using namespace std; int main(){ int n,s=0; cin>>n; while(n){ s+=n%10; n/=10; } cout<<s; return 0; }
徭役繁重
#include <bits/stdc++.h> using namespace std; int main(){ int x,sum=0; cin>>x; while (x>0){ sum+=x%10; x/=10; } cout<<sum; return 0; }
此账号已注销
LOVEKlee1314
#include <bits/stdc++.h> using namespace std; int main() { int n,sum=0; cin>>n; while(n) { sum+=n%10; n/=10; } cout<<sum; return 0; }
哒烧叶
准
#include <bits/stdc++.h> using namespace std; int main(){ int x,s=0; cin>>x; while(x!=0) { s+=x%10; x/=10; } cout<<s<<endl; return 0; }
Voldemort