0
Please can anyone provide me a c++ program to find number of digits in a given integer (using for loop c++ version 4.5)?
I am not able to understand how to write loop's update statement . but please provide me full program .
2 Réponses
+ 10
// Just the while loop part. I won't give you the full program.
int r = 0;
while (n > 0) {
n/=10;
++r
} // adds r by 1 and removes the first digit until it is 0.
+ 1
int i=0 , n ;
cin>>n;
while(n>0)
{
n=n/10;
i++;
}
cout<<i ;
return 0;
// this is the full program
//not really
//but run it and see
//good luck
// 😊😃😄☺👌