Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void putcharn(char character, int i) {
- for(int x = 0; x < i; x++) {
- putchar(character);
- }
- }
- int main(int argc, char *argv[]) {
- int treeWidth = 7;
- if (argc > 1) {
- sscanf(argv[1], "%d", &treeWidth);
- }
- for (int i = 1; i <= treeWidth; i += 2) {
- putcharn(' ', (treeWidth - i) / 2);
- putcharn('*', i);
- putchar('\n');
- }
- putcharn(' ', (treeWidth-1) / 2);
- printf("|\n");
- printf("* Merry Christmas, and a happy New Year! *\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment