1 #define _CRT_SECURE_NO_WARNINGS 2 3 #include<stdio.h> 4 #include<windows.h> 5 6 void change2(int num); 7 8 main() 9 { 10 int num; 11 scanf("%d", &num); 12 13 printf("num=%d\n", num); 14 15 change2(num); 16 17 system("pause"); 18 } 19 20 void change2(int num) 21 { 22 if (num == 0) 23 { 24 return; 25 } 26 else 27 { 28 change2(num / 2); 29 printf("%d", num % 2); 30 } 31 }
时间: 2024-10-07 21:59:30