Answers for "c program to find the sum of given number using recursion"

C
0

c program to find the sum of given number using recursion

# 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);
 }
Posted by: Guest on June-22-2020

Code answers related to "c program to find the sum of given number using recursion"

Code answers related to "C"

Browse Popular Code Answers by Language