From 44a0468a7e0842504fcfe8d67da04c45d2a24299 Mon Sep 17 00:00:00 2001 From: rk_kraken Date: Mon, 18 Nov 2024 09:14:37 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?/=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f1.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ fact.c | 18 +++++++++++ 2 files changed, 114 insertions(+) create mode 100644 f1.c create mode 100644 fact.c diff --git a/f1.c b/f1.c new file mode 100644 index 0000000..15c25f1 --- /dev/null +++ b/f1.c @@ -0,0 +1,96 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include + +void f1(int n) { + printf("%d ", n); + if (n > 1) { + f1(n - 2); + } +} + +void f2(int n) { + printf("%d ", n); + if (n < 11) { + f2(n + 2); + } +} + +void f3(int n) { + printf("%d ", n); + if (n > 1) { + f3(n - 2); + } + printf("%d", n); +} + +void recEGE1(int n) { + if (n >= 1) { + printf(" %d", n); + recEGE1(n - 1); + recEGE1(n - 1); + } +} + +void ege2(int n) { + if (n > 2) { + printf("%d\n", n); + ege2(n - 3); + ege2(n - 4); + } +} + +void ege3(int n) { + if (n < 5) { + printf("%d\n", n); + ege3(n + 1); + ege3(n + 3); + } +} + +void g3(int n); + +void ege4(int n) { + if (n > 0) + g3(n - 1); +} + +void g3(int n) { + printf("*"); + if (n > 1) + ege4(n - 3); +} + +void zad9(int n) { + if (n > 0) { + printf("<"); + zad9(n - 1); + printf("%d", n); + printf(">"); + } +} + +void main() { + f1(11); + printf("\n"); + + f2(1); + printf("\n"); + + f3(11); + printf("\n"); + + recEGE1(3); + printf("\n"); + + ege2(10); + printf("\n"); + + ege3(1); + printf("\n"); + + f3(11); + printf("\n"); + + zad9(5); +} \ No newline at end of file diff --git a/fact.c b/fact.c new file mode 100644 index 0000000..1aef283 --- /dev/null +++ b/fact.c @@ -0,0 +1,18 @@ +//#define _CRT_SECURE_NO_WARNINGS +//#include +//#include +// +//long fact2(int n) { +// if (n == 0) { +// return 1; +// } +// long res = fact2(n - 1) * n; +// return res; +//} +// +//void main() { +// int n = 4; +// long f = fact2(n); +// +// printf("%d! = %ld", n, f); +//} \ No newline at end of file