do / while
C++ Loops
post-condition loop
Flowchart (ISO 5807)
Source code
int countDigits(int n) {
int c = 0;
do {
c++;
n /= 10;
} while (n > 0);
return c;
} post-condition loop
int countDigits(int n) {
int c = 0;
do {
c++;
n /= 10;
} while (n > 0);
return c;
}