Skip to content

Instantly share code, notes, and snippets.

@aryan348
Last active July 16, 2020 15:15
Show Gist options
  • Save aryan348/4e2909089b02d7b902b21cd33436b057 to your computer and use it in GitHub Desktop.
Save aryan348/4e2909089b02d7b902b21cd33436b057 to your computer and use it in GitHub Desktop.
CS50 Problem Set 1 (Fall 2020) - Mario less
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
do
{
// to get height from user
n = get_int("Height: ");
}
// height range should be less than 8 and greater than 1
while (n < 1 || n > 8);
for (int i = 0; i < n; i++)
{
for (int s = 1; s<n-i; s++)
{
printf(" ");
}
for (int j = 0; j <= i; j++)
{
printf("#");
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment