diff options
Diffstat (limited to 'graphs/piscine/pine/pine.c')
| -rw-r--r-- | graphs/piscine/pine/pine.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/graphs/piscine/pine/pine.c b/graphs/piscine/pine/pine.c new file mode 100644 index 0000000..9d48761 --- /dev/null +++ b/graphs/piscine/pine/pine.c @@ -0,0 +1,36 @@ +#include <stdio.h> + +int pine(unsigned n) +{ + if (n < 3) + { + return 1; + } + + for (unsigned i = 0; i < n; i++) + { + for (unsigned j = 0; j < n - i - 1; j++) + { + putchar(' '); + } + + for (unsigned j = 0; j < 2 * i + 1; j++) + { + putchar('*'); + } + + putchar('\n'); + } + + for (unsigned i = 0; i < n / 2; i++) + { + for (unsigned j = 0; j < n - 1; j++) + { + putchar(' '); + } + putchar('*'); + putchar('\n'); + } + + return 0; +} |
