#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int sum=0;
while(n>0){
int x=n%10;
sum=sum+x;
n=n/10;
}
cout<<sum;
return 0;
}
CCF数位之和
最新推荐文章于 2023-08-30 18:26:45 发布
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int sum=0;
while(n>0){
int x=n%10;
sum=sum+x;
n=n/10;
}
cout<<sum;
return 0;
}