Ⅰ c語言編寫程序輸入5位以內任何數字,分離每一位數值,並輸出各位的和的代碼
#include <stdio.h>int main() {int n;int sum=0;printf(「請輸入任意一個1-99999的數字:");scanf("%d", &n); while (n!=0) { printf("%d ", n%10); sum+= n%10; n/=10; }printf("\n各位數字之和:%d\n", sum);return 0;}