Brijmohan lal Sahu - Facebook
ads
ads

Sunday, November 16, 2014

Program to find length or numbers of digits in any number using for loop in C++.



Code Box
---------------------------------------------

/*Program to find length or numbers of digits in any number*/

#include<iostream.h>
#include<conio.h>
void main()
{
int num,len;

clrscr();

cout<<"\nEnter A Number :";
cin>>num;


for(len=0;num>=1;)
{
num=num/10;
len++;
}
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