This commit is contained in:
2023-09-23 22:20:41 +03:00
parent 609aa52e66
commit 66997adad5
42 changed files with 642 additions and 0 deletions

22
recursion.c Executable file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
int myProg(int k);
int main() {
int b;
printf("Type a num: \n");
scanf("%d", &b);
int result = myProg(b);
printf("%d\n", result);
return 0;
}
int myProg(int k) {
if (k > 10) {
return k + myProg(k - 1);
} else {
return 0;
}
}