Skip to content

Instantly share code, notes, and snippets.

@penut85420
Created May 22, 2018 17:51
Show Gist options
  • Save penut85420/80b1644c294d63bcc49d5c29c4cc1373 to your computer and use it in GitHub Desktop.
Save penut85420/80b1644c294d63bcc49d5c29c4cc1373 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
int h;
int i, j, k;
printf("Height of triangle: ");
scanf("%d", &h);
for (i = 1; i <= h; i++) {
for (j = 0; j < h - i; j++)
printf(" ");
for (j = 0; j < i * 2 - 1; j++)
printf("*");
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment