Closed harshraj8843 closed 1 year ago
!assign
!assign
This program already exists in the project. This issue should be marked as resolved.
Hey @apurvagandhi, thanks for reporting this 👍🏻
If you like, you can improve the code to work with recursion https://github.com/codinasion/codinasion/blob/master/program/program/find-average-of-digits-of-a-number-by-recursion/find-average-of-digits-of-a-number-by-recursion.py
def average_of_digits(n):
if n == 0:
return 0
digits = [int(d) for d in str(n)]
return sum(digits) / len(digits)
print(average_of_digits(123))
!assign
!assign
@harshraj8843 there's already a file available for the above issue, do i need to open a new PR for the same ?
Description
Write a GO program to find average of digits of a number by recursion
Average of digits of a number is the sum of digits of the number divided by the number of digits in the number. For example, the average of digits of 123 is 6. The sum of digits of 123 is 6 and the number of digits in 123 is 3. So, the average of digits of 123 is 6/3 = 2.
How to contribute
- Save the solution in `program/program/find-average-of-digits-of-a-number-by-recursion/find_average_of_digits_of_a_number_by_recursion.go` file