Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6534 邓小龙 各个位数之和 C++ Accepted 0 MS 252 KB 397 2025-03-07 10:43:49

Tests(5/5):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,s=0; cin>>n; while(n!=0){ int g = n%10; n=n/10; s=s+g; } cout<<s<<endl; return 0; }