181 lines
2.6 KiB
C
181 lines
2.6 KiB
C
|
#include "func.h"
|
|||
|
|
|||
|
#ifdef Z1
|
|||
|
void ot1do10(), ot10do1(), ot1_5odd(), ot1do100_10(), ot1000do100_100(), ot1000do0();
|
|||
|
|
|||
|
void Menu() {
|
|||
|
int n;
|
|||
|
|
|||
|
do
|
|||
|
{
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|||
|
printf("1) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> 1 <20><> 10\n");
|
|||
|
printf("2) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> 10 <20><> 1\n");
|
|||
|
printf("3) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> 1\n");
|
|||
|
printf("11) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10 <20><><EFBFBD><EFBFBD><EFBFBD> <20><> 10 <20><> 100\n");
|
|||
|
printf("12) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10 <20><><EFBFBD><EFBFBD><EFBFBD> <20><> 1000 <20><> 100\n");
|
|||
|
printf("20) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 1000 <20><> 0 <20> <20><><EFBFBD><EFBFBD><EFBFBD>\n\n");
|
|||
|
printf("99) <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
|
|||
|
scanf_s("%d", &n);
|
|||
|
|
|||
|
switch (n)
|
|||
|
{
|
|||
|
case 1:
|
|||
|
ot1do10();
|
|||
|
break;
|
|||
|
case 2:
|
|||
|
ot10do1();
|
|||
|
break;
|
|||
|
case 3:
|
|||
|
ot1_5odd();
|
|||
|
break;
|
|||
|
case 11:
|
|||
|
ot1do100_10();
|
|||
|
break;
|
|||
|
case 12:
|
|||
|
ot1000do100_100();
|
|||
|
break;
|
|||
|
case 20:
|
|||
|
ot1000do0();
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
} while (n != 99);
|
|||
|
}
|
|||
|
|
|||
|
void twospace() {
|
|||
|
printf("\n\n");
|
|||
|
}
|
|||
|
|
|||
|
void ot1do10() {
|
|||
|
int i = 1;
|
|||
|
while (i <= 10) {
|
|||
|
printf("%d ", i++);
|
|||
|
}
|
|||
|
twospace();
|
|||
|
}
|
|||
|
|
|||
|
void ot10do1() {
|
|||
|
int i = 10;
|
|||
|
while (i >= 1) {
|
|||
|
printf("%d ", i--);
|
|||
|
}
|
|||
|
twospace();
|
|||
|
}
|
|||
|
|
|||
|
void ot1_5odd() {
|
|||
|
int i = 0;
|
|||
|
while (i <= 4) {
|
|||
|
printf("%d ", 2 * i + 1);
|
|||
|
i++;
|
|||
|
}
|
|||
|
twospace();
|
|||
|
}
|
|||
|
|
|||
|
void ot1do100_10() {
|
|||
|
int i = 1;
|
|||
|
while (i <= 10) {
|
|||
|
printf("%d ", i * 10);
|
|||
|
i++;
|
|||
|
}
|
|||
|
twospace();
|
|||
|
}
|
|||
|
|
|||
|
void ot1000do100_100() {
|
|||
|
int i = 10;
|
|||
|
while (i >= 1) {
|
|||
|
printf("%d ", i * 100);
|
|||
|
i--;
|
|||
|
}
|
|||
|
twospace();
|
|||
|
}
|
|||
|
|
|||
|
void ot1000do0() {
|
|||
|
int i = 1000;
|
|||
|
int shag;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>:");
|
|||
|
scanf_s("%d", &shag);
|
|||
|
cycle:
|
|||
|
printf("%d ", i);
|
|||
|
i -= shag;
|
|||
|
if (i > 0) goto cycle;
|
|||
|
printf("%d", 0);
|
|||
|
twospace();
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
#ifdef Z2
|
|||
|
void pif(), MN(), triangle();
|
|||
|
|
|||
|
void Menu() {
|
|||
|
int n;
|
|||
|
|
|||
|
do
|
|||
|
{
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|||
|
printf("1) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
printf("2) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> M <20><><EFBFBD><EFBFBD><EFBFBD> <20> N <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
printf("3) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n");
|
|||
|
printf("99) <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
|
|||
|
scanf_s("%d", &n);
|
|||
|
|
|||
|
switch (n)
|
|||
|
{
|
|||
|
case 1:
|
|||
|
pif();
|
|||
|
break;
|
|||
|
case 2:
|
|||
|
MN();
|
|||
|
break;
|
|||
|
case 3:
|
|||
|
triangle();
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
} while (n != 99);
|
|||
|
}
|
|||
|
|
|||
|
void MN() {
|
|||
|
int M = 0, N = 0;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> M <20> N\n");
|
|||
|
scanf_s("%d%d", &M, &N);
|
|||
|
int i = 1;
|
|||
|
while (i <= M) {
|
|||
|
int j = 1;
|
|||
|
while (j <= N) {
|
|||
|
printf("%d%d ", i, j);
|
|||
|
j++;
|
|||
|
}
|
|||
|
printf("\n\n");
|
|||
|
i++;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void triangle() {
|
|||
|
int i = 0;
|
|||
|
do {
|
|||
|
int j = 0;
|
|||
|
while (j < i+1) {
|
|||
|
printf("%d ", 5-j);
|
|||
|
j++;
|
|||
|
}
|
|||
|
i++;
|
|||
|
printf("\n");
|
|||
|
} while (i < 5);
|
|||
|
}
|
|||
|
|
|||
|
void pif() {
|
|||
|
int i = 1;
|
|||
|
while (i <= 10) {
|
|||
|
int j = 1;
|
|||
|
while (j <= 10) {
|
|||
|
printf("%3d ", i * j);
|
|||
|
j++;
|
|||
|
}
|
|||
|
printf("\n\n");
|
|||
|
i++;
|
|||
|
}
|
|||
|
}
|
|||
|
#endif
|