# include & ltstdio.h & gt
int main()
{
int a,b;
int I;
Printf ("Please enter a number:");
scanf("%d ",& ampa);
b = a;
for(I = 0; a & gt 1; i++)
{
a = a/ 10;
}
Printf("%d is %d digits \n ",b, i);
}
Extended data:
A detailed explanation of the idea:
In C language, integer division is often used to determine the specific number of bits of an integer. Similarly, integer division can be used here to determine the number of digits of a number.
First, use the scanf function to get the value of this number and assign it to the variable B for backup.
Then, the core idea is that when a number is divisible by 10 and the first result is 1, the number is a single digit. Therefore, it is regarded as the subject in the loop.
get for(I = 0; a & gt 1; i++)a = a/ 10; Such code can eventually output results.