怎样用c语言求一个数的各个位置上的数的和

怎样用c语言求一个数的各个位置上的数的和...
2026年09月21日 17:47
有1个网友回答
网友(1):

int sum = 0;
while(n>0){
sum += n%10;
sum /= 10;
}