diff --git a/Lb17/Lb17/FileName.cpp b/Lb17/Lb17/FileName.cpp index 1ae0f18..d53980d 100644 --- a/Lb17/Lb17/FileName.cpp +++ b/Lb17/Lb17/FileName.cpp @@ -23,60 +23,60 @@ // 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 recEGE1(int n) { -// if (n >= 1) { +//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); -// recEGE1(n - 1); -// recEGE1(n - 1); // } //} // //void main() { -// recEGE1(3); +// 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) { + printf(" %d", n); + recEGE1(n - 1); + recEGE1(n - 1); + } +} + +void main() { + recEGE1(3); +} //void F1(int n) //{