Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void print(int x) {
- for (int i = 1; i <= x / 2 + 1; ++ i) {
- for (int j = 1; j <= 5 - i; ++ j) {
- cout << " ";
- }
- for (int j = 1; j <= (i - 1) * 2 + 1; ++ j) {
- cout << x << " ";
- }
- cout << '\n';
- }
- for (int i = x / 2; i >= 1; -- i) {
- for (int j = 1; j <= 5 - i; ++ j) {
- cout << " ";
- }
- for (int j = 1; j <= (i - 1) * 2 + 1; ++ j) {
- cout << x << " ";
- }
- cout << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement