-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bai60_HinhChuNhatKiTu4.cpp
60 lines (37 loc) · 971 Bytes
/
Bai60_HinhChuNhatKiTu4.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
char kyTu(int n) {
return char(n);
}
using namespace std;
int main() {
int a, b;
cin >> a >> b;
char arr[100];
for (int i = 0; i < b; i++) {
arr[i] = kyTu(65 + i);
}
if (a <= b) {
for (int i = 0; i < a; i++) {
for (int j = a - i-1; j < b - 1;j++)
cout << arr[j];
for (int j = 0; j < a-i; j++)
cout << arr[b - 1];
cout << "\n";
}
}
if (a > b) {
for (int i = 0; i < b - 1; i++) {
for (int j = 0; j < b; j++)
cout << arr[b - 1];
cout << "\n";
}
for (int i = 0; i < b; i++) {
for (int j = b - i - 1; j < b-1; j++)
cout << arr[j];
for (int j = i; j < b; j++)
cout << arr[b - 1];
cout << endl;
}
}
return 0;
}