Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Sum of two digits by recursion | C program

#include<stdio.h>
int so(int);

int main()
{
 int i;
 printf(" Enter any number : ");
 scanf("%d",&i);
 printf("Sum of digit are : %d",so(i));
 return 0;
}

int so(int n)
{
 if(n<1)
  return 0;
 return(n%10+so(n/10));
}
Bhuvan Arora

No comments:

Amazing Deal !