From b73983c3717642ca10e7cfe93d97609adc377da9 Mon Sep 17 00:00:00 2001 From: smlckz Date: Wed, 22 Dec 2021 14:56:13 +0530 Subject: backup --- assignments/16-star-pattern-extreme.c | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 assignments/16-star-pattern-extreme.c (limited to 'assignments/16-star-pattern-extreme.c') diff --git a/assignments/16-star-pattern-extreme.c b/assignments/16-star-pattern-extreme.c new file mode 100644 index 0000000..97d4d8d --- /dev/null +++ b/assignments/16-star-pattern-extreme.c @@ -0,0 +1,50 @@ +#include + +int main(void) +{ + int i, j, h; + printf("Enter a height: "); + scanf("%d", &h); + for (i = 1; i <= h; i++) { + for (j = 1; j <= i; j++) { + printf("*"); + } + for (j = 1; j <= 2 * h - 2 * i; j++) { + printf(" "); + } + for (j = 1; j <= i; j++) { + printf("*"); + } + printf("\n"); + } + return 0; +} + +/* +Output: +Set 1: +Enter a height: 4 +* * +** ** +*** *** +******** + +Set 2: +Enter a height: 5 +* * +** ** +*** *** +**** **** +********** + +Set 3: +Enter a height: 6 +* * +** ** +*** *** +**** **** +***** ***** +************ + +*/ + -- cgit 1.4.1-2-gfad0