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 .

11th Nov 2017, 11:03 AM
pundarikaksh narayan tripathi
pundarikaksh narayan tripathi - avatar
2 Respuestas
+ 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.
11th Nov 2017, 11:23 AM
qwerty
qwerty - avatar
+ 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 // 😊😃😄☺👌
11th Nov 2017, 5:27 PM
Loai Salem
Loai Salem - avatar