diff options
author | smlckz <smlckz@college> | 2021-12-22 14:56:13 +0530 |
---|---|---|
committer | smlckz <smlckz@college> | 2021-12-22 14:56:13 +0530 |
commit | b73983c3717642ca10e7cfe93d97609adc377da9 (patch) | |
tree | a6e9fe4c27e3caa215f8aefa9265fb52f6de4375 /assignments/15-star-pattern-eql.c | |
download | college-b73983c3717642ca10e7cfe93d97609adc377da9.tar.gz |
backup
Diffstat (limited to 'assignments/15-star-pattern-eql.c')
-rw-r--r-- | assignments/15-star-pattern-eql.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/assignments/15-star-pattern-eql.c b/assignments/15-star-pattern-eql.c new file mode 100644 index 0000000..e32b745 --- /dev/null +++ b/assignments/15-star-pattern-eql.c @@ -0,0 +1,47 @@ +#include <stdio.h> + +int main(void) +{ + int i, j, h; + printf("Enter a height: "); + scanf("%d", &h); + for (i = 1; i <= h; i++) { + for (j = 1; j <= h - i; j++) { + printf(" "); + } + for (j = 1; j <= 2 * i - 1; j++) { + printf("*"); + } + printf("\n"); + } + return 0; +} + +/* +Output: +Set 1: +Enter a height: 3 + * + *** +***** + +Set 2: +Enter a height: 5 + * + *** + ***** + ******* +********* + +Set 3: +Enter a height: 7 + * + *** + ***** + ******* + ********* + *********** +************* + +*/ + |