summary refs log blame commit diff stats
path: root/assignments/14-star-pattern-90t.c
blob: 2a285d2aee7169e4bcaccca3e1380d56e9b0dead (plain) (tree)














































                                                    
#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 <= 2 * (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
            *
          ***
        *****
      *******
    *********
  ***********
*************

*/