数位数的算法

#include<stdio.h>
int main()
{
int x;
scanf("%d",&x);
int n=0;
do
{
    x/=10;
    n++;
}while(x>0);
printf("%d",n);
}

 do while 直到循环,先循环后判断

 

posted @ 2022-11-02 11:09  飞雪飘鸿  阅读(41)  评论(0编辑  收藏  举报
https://damo.alibaba.com/ https://tianchi.aliyun.com/course?spm=5176.21206777.J_3941670930.5.87dc17c9BZNvLL