Compare commits
No commits in common. "e6210211c699f2d203fc8d928c7d26a818f21de7" and "17bbb168113c76d44596737453759d99c8436d55" have entirely different histories.
e6210211c6
...
17bbb16811
142
FileName.cpp
142
FileName.cpp
@ -1,142 +0,0 @@
|
|||||||
#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) {
|
|
||||||
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");// âûâîä íå÷¸òíûõ ÷èñåë ïî óáûâàíèþ
|
|
||||||
f22(n); // âûâîä íå÷¸òíûõ ÷èñåë ïî âîçðàñòàíèþ
|
|
||||||
}
|
|
||||||
void f4(int n) {
|
|
||||||
f1(n); // âûâîä íå÷¸òíûõ ÷èñåë ïî óáûâàíèþ
|
|
||||||
f23(n); // âûâîä íå÷¸òíûõ ÷èñåë ïî âîçðàñòàíèþ
|
|
||||||
}
|
|
||||||
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); // âûçûâàåì 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;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user