计算整数的位数

来源:互联网 发布:c语言一共有多少个函数 编辑:程序博客网 时间:2024/06/05 04:49
#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;}


0 0