C语言 do while 语句

#include <stdio.h>
int main()
{
    int count,number;
    count=0;
    printf("Enter number:");
    scanf("%d",&number);
    if(number<0)
        number=-number;
    do {number/=10;
        count++;}
    while (number!=0);
    printf("It count is %d digits.\n",count);


}

do while是先执行后判断。

猜你喜欢

转载自www.cnblogs.com/httpwwwachangcom/p/9475141.html