Added my works from 2022

This commit is contained in:
2024-11-21 09:11:52 +03:00
parent facd000301
commit 02068890a5
7 changed files with 161 additions and 0 deletions

18
alg_4_4.cpp Normal file
View File

@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;
int f(int n, int sum)
{
if (n == 0)
{
return sum;
}
return f(n / 10, sum + n % 10);
}
int main()
{
int n; cin >> n;
cout << f(n, 0);
}