题解 | #添加逗号#
添加逗号
https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed
#include <stdio.h> int main() { long long n; char str[100] = {0}; int count = 0; scanf("%lld", &n); for (int i = 0; n > 0; i++) { if (i % 4 == 3) { str[i] = ','; } else { str[i] = n % 10+'0'; n /= 10; } } for (int i = strlen(str)-1; i >= 0; i--) { printf("%c", str[i]); } return 0; }