C Program for finding the sum of digits in the given number using recursion
#include<stdio.h>
#include<conio.h>
int sum(long
int a);
void main()
{
long int num;
clrscr();
printf("Enter any number for find sum of
digits in it\n");
scanf("%ld",&num);
printf("Sum of digits in %ld is
%d",num,sum(num));
getch();
}
int sum(long
int n)
{
if(n>0)
return((n%10)+sum(n/10));
else
return 0;
}
OUTPUT
You can also visit:-