整数逆转
通过把整数变换为字符输出.
1 #define _CRT_SECURE_NO_WARNINGS 2 #include <stdio.h> 3 #include <stdlib.h> 4 5 void main() 6 { 7 int c, count; 8 printf("enter number:"); 9 scanf("%d", &count); 10 while (count ) 11 { 12 c = count % 10 + '0'; 13 count /= 10; 14 putchar(c); 15 } 16 system("pause"); 17 }