From 567a21d2f2795f52083f6cfa169a86bfb88517c4 Mon Sep 17 00:00:00 2001 From: fieesr Date: Mon, 18 Nov 2024 22:54:21 +0400 Subject: [PATCH] test --- Lb17/Lb17/FileName.cpp | 106 ++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/Lb17/Lb17/FileName.cpp b/Lb17/Lb17/FileName.cpp index 41db1b8..1ae0f18 100644 --- a/Lb17/Lb17/FileName.cpp +++ b/Lb17/Lb17/FileName.cpp @@ -23,48 +23,48 @@ // printf("%d! = %ld", n, f); //} -//void f1(int n) { -// printf(" %d", n); -// if (n > 1) { -// f1(n - 2); -// } -// -//} -// -//void f2(int n) { -// if (n > 1) { -// f2(n - 2); -// } -// printf(" %d", n); -//} -// -//void f3(int n) { -// printf(" %d", n); -// if (n > 1) { -// f3(n - 2); -// } -// if (n != 1) { -// printf(" %d", n); -// } -//} -// -//void main() { -// int n; -// printf("n = "); -// scanf_s("%d", &n); -// -// printf("f1 "); -// f1(n); -// printf("\n"); -// -// printf("f2 "); -// f2(n); -// printf("\n"); -// -// printf("f3 "); -// f3(n); -// printf("\n"); -//} +void f1(int n) { + printf(" %d", n); + if (n > 1) { + f1(n - 2); + } + +} + +void f2(int n) { + if (n > 1) { + f2(n - 2); + } + printf(" %d", n); +} + +void f3(int n) { + printf(" %d", n); + if (n > 1) { + f3(n - 2); + } + if (n != 1) { + printf(" %d", n); + } +} + +void main() { + int n; + printf("n = "); + scanf_s("%d", &n); + + printf("f1 "); + f1(n); + printf("\n"); + + printf("f2 "); + f2(n); + printf("\n"); + + printf("f3 "); + f3(n); + printf("\n"); +} //void recEGE1(int n) { // if (n >= 1) { @@ -78,14 +78,14 @@ // recEGE1(3); //} -void F1(int n) -{ - if (n > 2) { - printf("%d ", n); - F1(n - 3); - F1(n - 4); - } -} -void main() { - F1(10); -} \ No newline at end of file +//void F1(int n) +//{ +// if (n > 2) { +// printf("%d ", n); +// F1(n - 3); +// F1(n - 4); +// } +//} +//void main() { +// F1(10); +//} \ No newline at end of file