122 lines
1.8 KiB
C++
122 lines
1.8 KiB
C++
|
#include <stdio.h>
|
|||
|
#include <Windows.h>
|
|||
|
|
|||
|
void print1_10() {
|
|||
|
int a = 1;
|
|||
|
do {
|
|||
|
printf("%d ", a);
|
|||
|
a += 1;
|
|||
|
} while (a <= 10);
|
|||
|
}
|
|||
|
|
|||
|
void print10_1() {
|
|||
|
int a = 10;
|
|||
|
do {
|
|||
|
printf("%d ", a);
|
|||
|
a -= 1;
|
|||
|
} while (a >= 1);
|
|||
|
}
|
|||
|
|
|||
|
void print50dds() {
|
|||
|
int a = 1;
|
|||
|
int i = 1;
|
|||
|
do {
|
|||
|
printf("%d ", a);
|
|||
|
a += 2;
|
|||
|
i += 1;
|
|||
|
} while (i <= 5);
|
|||
|
}
|
|||
|
|
|||
|
void print100_10_while() {
|
|||
|
int a = 100;
|
|||
|
while (a >= 10) {
|
|||
|
printf("%d ", a);
|
|||
|
a -= 10;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void print1000_100_while() {
|
|||
|
int a = 1000;
|
|||
|
while (a >= 100) {
|
|||
|
printf("%d ", a);
|
|||
|
a -= 100;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void deposit() {
|
|||
|
int sum;
|
|||
|
int percent;
|
|||
|
int year = 0;
|
|||
|
printf("S = ");
|
|||
|
scanf_s("%d", &sum);
|
|||
|
printf("n = ");
|
|||
|
scanf_s("%d", &percent);
|
|||
|
while (year <= 10) {
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD>: %d\n", year, sum);
|
|||
|
sum = sum + (sum * percent / 100);
|
|||
|
year = year + 1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void print1000_0_n() {
|
|||
|
int a = 1000, n = 13;
|
|||
|
printf("n = 13\n");
|
|||
|
while (a > 0) {
|
|||
|
printf("%d ", a);
|
|||
|
a -= n;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void main() {
|
|||
|
SetConsoleCP(1251);
|
|||
|
SetConsoleOutputCP(1251);
|
|||
|
int n;
|
|||
|
do {
|
|||
|
printf("\n");
|
|||
|
printf("\n");
|
|||
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 1\n");
|
|||
|
printf("11: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> 100 <20><> 10 (<28><><EFBFBD>: 10)\n");
|
|||
|
printf("12: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> 1000 <20><> 100 (<28><><EFBFBD>: 100)\n");
|
|||
|
printf("13: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
printf("20: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> 1000 <20><> 0 (<28><><EFBFBD>: n)\n");
|
|||
|
printf("\n");
|
|||
|
printf("0: <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
|
|||
|
scanf_s("%d", &n);
|
|||
|
|
|||
|
switch (n) {
|
|||
|
case 1:
|
|||
|
print1_10();
|
|||
|
break;
|
|||
|
|
|||
|
case 2:
|
|||
|
print10_1();
|
|||
|
break;
|
|||
|
|
|||
|
case 3:
|
|||
|
print50dds();
|
|||
|
break;
|
|||
|
|
|||
|
case 11:
|
|||
|
print100_10_while();
|
|||
|
break;
|
|||
|
|
|||
|
case 12:
|
|||
|
print1000_100_while();
|
|||
|
break;
|
|||
|
|
|||
|
case 13:
|
|||
|
deposit();
|
|||
|
break;
|
|||
|
|
|||
|
case 20:
|
|||
|
print1000_0_n();
|
|||
|
break;
|
|||
|
|
|||
|
}
|
|||
|
} while (n != 0);
|
|||
|
}
|