Check out example codes for "c program to find the sum of given number using recursion". It will help you in understanding the concepts better.

Code Example 1

# include <stdio.h>
int sum(int number);
int main
{
 int n;
 int a;
 printf("enter a number");
 scanf("%d,&n);
 a=sum(n);
 printf("sum=%d",a);
 }
int sum(int number)
{
  if (number==0)
    return 0;
  return(number%10+sum(number/10);
 }

Learn ReactJs, React Native from akashmittal.com