首页 > 其他 > 详细

计算整数的位数

时间:2014-12-31 14:37:38      阅读:317      评论:0      收藏:0      [点我收藏+]
#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)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!