Submission

Status:

PPPPPPP---

Subtask/Task Score:

70/100

Score: 70

User: bananatomyum2

Problemset: ผลรวมของเลขหลัก

Language: cpp

Time: 0.002 second

Submitted On: 2025-09-29 14:05:13

#include <bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	int x,y,re;
	cin >> x;
	re = 0;
	while(true){
		y = x % 10;
		re = re+y;
		x = x / 10;
		
		if(x==0){
			break;
		}
	}
	cout << re << "\n";
	return 0;
}