难不难?
2025-06-29 20:48:21
发布于:重庆
26阅读
0回复
0点赞
你们觉得难不难?
全部评论 3
不难呀!
#include <bits/stdc++.h> using namespace std; int main() { int a; cin >> a; long long sum = 0; while (a > 0) { sum += a % 10; a /= 10; } cout << sum; return 0; }2026-06-09 来自 湖南
02026-06-09 来自 湖南
0建议降红
2026-06-09 来自 湖南
0
#include <bits/stdc++.h> using namespace std; int a[1005]; int main(){ int x,cnt = 0; cin >> x; while(x > 0){ cnt += x%10; x = x / 10; } cout << cnt; return 0; }2025-06-29 来自 浙江
0easy
2025-06-29 来自 浙江
0












有帮助,赞一个