jhbj/FileName.cpp

143 lines
2.0 KiB
C++
Raw Permalink Normal View History

2024-11-05 16:42:28 +04:00
#include <stdio.h>
long fuct(int n) {
long res = 1;
for (int i = 1; i <= n; i++) {
res *= i;
}
return res;
}
void f1(int n) {
while (n >= 1) {
printf("%d ", n);
n -= 2;
}
}
void f11(int n) {
while (n >= 1) {
printf("<*%d ", n);
n -= 2;
}
}
void F1(int n) {
if (n > 2) {
printf("%d\n", n);
F1(n - 3);
F1(n - 4);
}
}
void F2(int n) {
if (n < 5) {
printf("%d\n", n);
F1(n + 1);
F1(n + 3);
}
}
void G3(int n);
void F3(int n) {
if (n > 0)
G3(n + 1);
}
void G3(int n) {
if (n > 1)
F3(n - 1);
}
void f2(int n) {
for (int i = 1; i <= n; i += 2]86) {
2024-11-05 16:42:28 +04:00
printf("%d ", i);
}
}
void f22(int n) {
for (int i = 1; i <= n; i += 2) {
printf("%d*>", i);
}
}
void f23(int n) {
for (int i = 3; i <= n; i += 2) {
printf("%d ", i);
}
}
void f3(int n) {
f11(n);
printf("s");// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
f22(n); // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
void f4(int n) {
f1(n); // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
f23(n); // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
void rec1(int n) {
printf(" %d", n);
if (n > 1) {
rec1(n - 1);
}
}
void rec2(int n) {
if (n > 1) {
rec2(n - 1);
}
printf(" %d", n);
}
void rec3(int n) {
printf(" %d", n);
if (n > 1) {
rec3(n - 1);
}
printf(" %d", n);
}
void recEGE1(int n) {
if (n >= 1) {
printf(" %d", n);
recEGE1(n - 1);
recEGE1(n - 1);
}
}
int main() {
int n;
scanf_s("%d", &n);
long f = fuct(n);
printf("%d! = %d\n", n, f);
f1(n);
printf("\n");
f2(n);
printf("\n");
f4(n);
printf("\n");
f3(n); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> f3(11)
printf("\n");
rec1(3);
printf(" rec1 FINISH\n");
rec2(3);
printf(" rec2 FINISH\n");
rec3(3);
printf(" rec3 FINISH\n");
recEGE1(3);
return 0;
}