#include<conio.h>
#include<stdio.h>
int sumdigit(int n);
void main()
{
int num;
printf("Enter Any Number : ");
scanf("%d",&num);
printf("\n Sum : %d",sumdigit(num));
getch();
}
int sumdigit(int n)
{
if(n/10==0)
return n;
else
return n%10+sumdigit(n/10);
}
#include<stdio.h>
int sumdigit(int n);
void main()
{
int num;
printf("Enter Any Number : ");
scanf("%d",&num);
printf("\n Sum : %d",sumdigit(num));
getch();
}
int sumdigit(int n)
{
if(n/10==0)
return n;
else
return n%10+sumdigit(n/10);
}
0 comments:
Post a Comment