mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Changes done
This commit is contained in:
parent
38df5b7b66
commit
d5b3040faa
@ -11,9 +11,13 @@
|
|||||||
/* Log based C++ program to count number of
|
/* Log based C++ program to count number of
|
||||||
* digits in a number/integer */
|
* digits in a number/integer */
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert> /// for assert
|
||||||
#include <iostream>
|
#include <iostream> /// for IO operations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Main function
|
||||||
|
* @returns 0 on exit
|
||||||
|
*/
|
||||||
int main() {
|
int main() {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -23,7 +27,6 @@ int main() {
|
|||||||
/* iterate until n becomes 0
|
/* iterate until n becomes 0
|
||||||
* remove last digit from n in each iteration
|
* remove last digit from n in each iteration
|
||||||
* increase count by 1 in each iteration */
|
* increase count by 1 in each iteration */
|
||||||
|
|
||||||
while (n != 0) {
|
while (n != 0) {
|
||||||
n /= 10; // n = n/10
|
n /= 10; // n = n/10
|
||||||
++count;
|
++count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user