How do you write a c program which accepts a positive integer and displays the number of digits?

1 answer

Answer

1257073

2026-08-26 22:55

+ Follow

#include
#include

void main()
{
unsigned long int num;
int i=0;
clrscr();
printf("Enter the digit\n");
scanf("%lu",&num);
while(num!=0)
{
num=num/10;
++i;
}
printf("Length=%d",i);
getch();
}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.