Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Darleneee93
Problemset: ผลรวมของเลขหลัก
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-07 11:33:41
#include <bits/stdc++.h>
using namespace std;
int main(){
string num;
cin >> num;
int ans=0;
if (num.length() <=0){
return 1;
}
for (int i=0;i<num.length();i++){
int number = num[i]-'0';
ans += number;
}
cout << ans;
}