sum of digits in c++ using recursion
// Recursive C++ program to find sum of digits(int)
#include <iostream>
using namespace std;
// Function to check sum of digit using recursion
int sum_of_digit(int n)
{
if (n == 0)
return 0;
return (n % 10 + sum_of_digit(n / 10));
}
int main(){
cout <<sum_of_digit(1234)<< endl;
return 0;
}