Skip to content

Instantly share code, notes, and snippets.

Created July 27, 2016 12:26
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 anonymous/55da24038d5028955127fd93d5f68cfd to your computer and use it in GitHub Desktop.
Save anonymous/55da24038d5028955127fd93d5f68cfd to your computer and use it in GitHub Desktop.
#include <cs50.h>
#include <stdio.h>
int main()
{
printf("Please input a non-negative integer up to 23\n");
int h = GetInt();
if (23<h || h<0)
{
do
{
printf("Retry:\n");
h= GetInt ();
} while (23<h || h<0);
}
if (24>h && h>-1)
{
int x=0;
int t=2;
int s=22;
while (x<h)
{
int a = 0;
int b = 0;
while (a<s)
{
printf(" ");
a++;
}
while (b<t)
{
printf("#");
b++;
}
printf("\n");
x++;
t++;
s--;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment