Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int width = 0;
- scanf("%i", &width);
- int upper = width / 2;
- int lower = 0;
- if (width % 2 > 0) {
- lower = upper;
- } else {
- lower = upper - 1;
- }
- for (int i = 0; i < upper; ++ i) {
- for (int j = 0; j < i; ++ j) {
- printf("| ");
- }
- printf("%c ", 218);
- for (int j = 0; j < width - 2 - 2 * i; ++ j) {
- printf("%c ", 196);
- }
- printf("%c ", 191);
- for (int j = 0; j < i; ++ j) {
- printf("| ");
- }
- printf("\n");
- }
- width -= 1;
- for (int i = lower - 1; i >= 0; -- i) {
- for (int j = 0; j < i; ++ j) {
- printf("| ");
- }
- printf("%c ", 192);
- for (int j = 0; j < width - 2 - 2 * i; ++ j) {
- printf("%c ", 196);
- }
- printf("%c ", 217);
- for (int j = 0; j < i; ++ j) {
- printf("| ");
- }
- printf("| ");
- printf("\n");
- }
- for (int j = 0; j < width; ++ j) {
- printf("%c ", 196);
- }
- printf("%c ", 217);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment