#include<stdio.h>
main()
{
int n,count=0;
printf(" Enter an integer: ");
scanf("%d", &n);
while(n!=0)
{
n/=10; /* n=n/10 */ ++count; }
printf("\n Number of digits: %d \n",count);
}
main()
{
int n,count=0;
printf(" Enter an integer: ");
scanf("%d", &n);
while(n!=0)
{
n/=10; /* n=n/10 */ ++count; }
printf("\n Number of digits: %d \n",count);
}
No comments:
Post a Comment