Skip to content

Instantly share code, notes, and snippets.

@aryan348
Last active July 16, 2020 15:15
Show Gist options
  • Save aryan348/66b7399fa81b0b2a0a8048f78cd467b6 to your computer and use it in GitHub Desktop.
Save aryan348/66b7399fa81b0b2a0a8048f78cd467b6 to your computer and use it in GitHub Desktop.
CS50 Problem Set 1 (Fall 2020) - Mario More
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
do
{
n = get_int("Height: ");
}
while (n < 1 || n > 8);
for (int i = 0; i < n; i++)
{
// pyramid 1 space
for (int s = 1; s < n - i; s++)
{
printf(" ");
}
// pyramid 1
for (int j = 0; j <= i; j++)
{
printf("#");
}
// space in between
for (int stwo = 0; stwo < 2; stwo++)
{
printf(" ");
}
// Pyramid 2
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