Brijmohan lal Sahu - Facebook
ads
ads

Sunday, November 16, 2014

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


number of digits


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;


while(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