Brijmohan lal Sahu - Facebook
ads
ads

Sunday, November 16, 2014

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

length of digit by do while loop


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