【C】#添加逗号#
添加逗号
https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
#include <stdio.h> #include <string.h> int main() { char arr[20] = {0}; scanf("%s", arr); int len = strlen(arr); for (int i = 0; i < len; i++) { printf("%c", arr[i]); if ((len - i) % 3 == 1 && i != len - 1) printf(","); } return 0; }