题解 | #添加逗号#
添加逗号
https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
#include <stdio.h> int main() { unsigned int num = 0; int arr[11] = {0}; scanf("%u",&num); int flag = 0; while (num > 0) { int cnt = num % 10; arr[flag] = cnt; num /= 10; flag++; } for (int i = flag-1; i >= 0; i--) { if (i % 3 ==0 && i != 0) { printf("%d,",arr[i]); } else { printf("%d",arr[i]); } } return 0; }