/* to read a number and count the no. of digits */
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n, count=0;
printf("Enter number: ");
scanf("%d",&n);
while(n!=0)
{
n/=10;
count+=1;
}
printf("The number of digits =%d",count);
system("pause");
return 0;
}
No comments:
Post a Comment