Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
221 B
0
Indexable
Never
#include <iostream>

int sum(long long num,int count = 0) {
	if (num == 0) return abs(count);
	sum(num / 10, count + (num % 10));

}

int main(){

	long long num;
	std::cin >> num;
	std::cout << sum(num);

}
Leave a Comment