Write a recursive function digitsum (n), enter a nonnegative integer, return the sum of the numbers that make up it,//For example, call Digitsum (1729), you should return 1 + 7 + 2 + 9, its and is 19//recursive version #include <stdio.h>int digitsum (int n) { int sum = 0; int m = 0; if (n) { m = n % 10; n = n / 10; sum = m + digitsum (n); } return sum;} Int main () { int n = 0; printf ("Please enter the number you want to convert:"), scanf ("%d", &n); int ret = digitsum (n); printf ("Each number of bits and is:%d\n", ret); return 0;} Non-recursive #include <stdio.h>int digitsum (int n) { int sum = 0; int m = 0; while (n) { m = n % 10; n = n / 10; sum = sum + m; } return sum;} Int main () {&NBsp;int n = 1892; int ret = digitsum (n); printf ("%d\n", ret); return 0;}
Enter a non-negative integer that returns the sum of the numbers that comprise it