Program to count number of digits using do-while loop.
#include <stdio.h>
#include <conio.h>
void main()
{
int i, b=0, c=0;
clrscr();
printf ("Enter a no: ");
scanf ("%d", &i);
do
{
b = i/10;
i = b;
c++;
}
while (i>0);
{
printf ("The no. of digits are: %d",c);
}
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int i, b=0, c=0;
clrscr();
printf ("Enter a no: ");
scanf ("%d", &i);
do
{
b = i/10;
i = b;
c++;
}
while (i>0);
{
printf ("The no. of digits are: %d",c);
}
getch();
}