Skip to content

Instantly share code, notes, and snippets.

@MuddyBootsCode
Created June 21, 2016 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MuddyBootsCode/2faeb4dcb70a5d1f063fcc2f0e037d02 to your computer and use it in GitHub Desktop.
Save MuddyBootsCode/2faeb4dcb70a5d1f063fcc2f0e037d02 to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<cs50.h>
int main (void)
{
int hgt = 0;// Initialize variable
int i, y;
do
{
printf("Height:");
hgt = GetInt();
} while (hgt <= 0 || hgt > 23);
for (i = 0; i < hgt; i++)
{
for (y = 0; y < hgt - i - 1; y++)
printf(" ");
for (y = 0; y < i + 2; y++)
printf("#");
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment