题解 | #小乐乐改数字#
小乐乐改数字
https://www.nowcoder.com/practice/fcd30aac9c4f4028b23919a0c649824d
#include <stdio.h> int main() { int n; scanf("%d", &n); char arr[100] = {'\0'}; sprintf(arr, "%d", n); //将整型转换为字符型 for(int i=0; arr[i]!='\0'; i++) if(arr[i]%2 == 0) arr[i] = '0'; else arr[i] = '1'; int res = atoi(arr); printf("%d\n", res); return 0; }