WHILE LOOP

//WAP TO COUNT OF DIGITS OF APRESENT IN A NUMBER ENTER BY USER
#include<iostream.h>
#include<stdlib.h>
void main()
{
int n,count=0;
cout<<"enter a number";
cin>>n;
while(n>0)
{
n=n/10;
count++;
}
cout<<"total number of digits="<<count;
system("pause");
}

Comments