C Program to count number of digits in the input

#include<stdio.h>
#include<conio.h>
void main()
{
int x,y=0;
clrscr();
printf("Enter Number:-\n");
scanf("%d",&x);
while(x>0)
{
x=x/10;
y++;
}
printf("Number of digits are:- %d",y);
getch();
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *