Skip to content

Instantly share code, notes, and snippets.

@indriApollo
Created April 28, 2022 18:22
Show Gist options
  • Save indriApollo/26e1cece3c55cf94840040debeaf6c73 to your computer and use it in GitHub Desktop.
Save indriApollo/26e1cece3c55cf94840040debeaf6c73 to your computer and use it in GitHub Desktop.
void print_triangle(unsigned char width)
{
unsigned char rows = (width + 1) / 2;
for (unsigned char i = 0; i < rows; i++)
{
for(unsigned char j = 0; j < rows-i-1; j++)
{
printf(" ");
}
for(unsigned char k = 0; k < (i*2)+1; k++)
{
printf("0");
}
printf("\n");
}
printf("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment