C++ Program to count no. of digits in the input

      No Comments on C++ Program to count no. of digits in the input
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,y=0;
cout<<"Enter Number:-"<<endl;
cin>>x;
while(x>0)
{
x=x/10;
y++;
}
cout<<"Number of digits are:- "<<y;
getch();
}

OUTPUT:-

Leave a Reply

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