计算整数的位数

时间:2014-12-31 14:37:38   收藏:0   阅读:319
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n=0;

    while ( EOF != scanf("%d", &n) )
    {
        int reverseNum =0;
        int temp = n;
        int count = 0;
        while (0 != temp)
        {
            reverseNum = reverseNum * 10 + temp%10;
            temp /= 10;
            count++;
        }
        printf("%d %d\n", count, reverseNum);

    }

    return 0;
}


原文:http://blog.csdn.net/xiaohanstu/article/details/42293677

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!