# include <stdio.h>
# include <conio.h>
void main()
{
int n, count = 0 ;
clrscr() ;
printf("Enter a number : ") ;
scanf("%d", &n) ;
while(n > 0)
{
count++ ;
n = n / 10 ;
}
printf("\nThe number of digits is : %d", count) ;
getch() ;
}
RUN 1 :
~~~~~~~
Enter a number : 179
The number of digits is : 3
No comments:
Post a Comment