Skip to content

Conversation

@Lumowhisp
Copy link

This PR adds a small utility function to count the number of digits in an integer.
The implementation is simple and follows patterns used in other files in the math directory.
Basic test cases have been added using assert to ensure correctness.

Description of Change

•	Added a new file count_digits.cpp under the math directory. •	Implemented count_digits(int n) to return the total number of digits in a given integer. •	Added a small test function using assert to verify expected outputs. •	Included brief comments for readability and consistency with other files. 

Checklist

•	Added description of change •	File name follows guidelines (count_digits.cpp) •	Added tests using assert •	Added minimal documentation for readability •	PR title follows semantic guidelines •	No duplicate implementation found •	I acknowledge that my contribution will be under the project’s license 

Notes

Simple implementation of a digit-counting function with small test cases.
Suitable for the math section and consistent with existing examples.

This PR adds a simple function to count the number of digits in an integer. Includes basic test cases using assert. Follows the style used in other math algorithms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant