mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-11-26 05:35:05 +08:00
Modified comments
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
/**
|
||||
* @author [ANSHUMAAN](https://github.com/amino19)
|
||||
* @file:[Program to count digits in an
|
||||
* @file [Program to count digits in an
|
||||
* integer](https://www.geeksforgeeks.org/program-count-digits-integer-3-different-methods)
|
||||
*
|
||||
* \brief Finding number of Digits in a Number
|
||||
* \details It is a very basic math of finding
|
||||
* number of digits in a given number i.e, we
|
||||
* can use it by inputting values it can be a
|
||||
* positive/negatie value, lets say integer.
|
||||
*
|
||||
* can use it by inputting values whether it
|
||||
* can be a positive/negatie value, lets say
|
||||
* integer.
|
||||
* For more details, refer Algorithms-Explanation
|
||||
*/
|
||||
|
||||
/* Log based C++ program to count number of
|
||||
* digits in a number/integer */
|
||||
|
||||
#include <cassert> /// for assert
|
||||
#include <iostream> /// for IO operations
|
||||
|
||||
@@ -23,6 +20,7 @@
|
||||
* @returns 0 on exit
|
||||
*/
|
||||
int main() {
|
||||
/* Initialize 'n' & 'count' by 0 */
|
||||
int n = 0;
|
||||
int count = 0;
|
||||
std::cout << "Enter an integer: ";
|
||||
@@ -33,7 +31,7 @@ int main() {
|
||||
while (n != 0) {
|
||||
/* we can also use: n = n/10 */
|
||||
n /= 10;
|
||||
/* each time while loop running, count will
|
||||
/* each time while loop running, count will
|
||||
* be increment by 1.
|
||||
*/
|
||||
++count;
|
||||
|
||||
Reference in New Issue
Block a user