Code Box
---------------------------------------------
/*Program to find length or numbers of digits in any number*/
#include<iostream.h>
#include<conio.h>
void main()
{
int num,len;
len=0;
clrscr();
cout<<"\nEnter A Number :";
cin>>num;
do{
num=num/10;
len++;
}
while(num>=1);
cout<<"\nLength Number:"<<len;
getch();
}
/* Note: Due to the range of integer program does not work for more than 5 digits */
No comments:
Post a Comment