3164 输出位数

#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int sum = 0; //统计位数
    while(n != 0)
    {
        sum++;
        n /= 10; //每分割一位数就统计位数+1
    }
    cout << sum;
    return 0;
}

 

posted @ 2024-06-30 22:45  CRt0729  阅读(1)  评论(0编辑  收藏  举报