C++ program – No of Digits in a number (Using while loop)

by Nideesh C on May 2, 2011 · 0 comments

in C++




//Downloaded From theonlinetutorials.com
//(C)2011.All rights reserved.

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x=0,n;
cout<<"Enter the number :";
cin>>n;
while(n>0)
{
n=n/10;
x=x+1;
}
cout<<"The no of digits are :"<<x;
getch();
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C++ Program – No of Digits
  2. Sample – Program to convert 2-digit octal number into binary number and print it.
  3. Sample – Program to count the number of words and characters in a sentence.
  4. C++ class program – perform rational number arithmetic
  5. C++ program – calculate the factorial of a number using recursion.

Leave a Comment

Previous post:

Next post: