Skip to content

Instantly share code, notes, and snippets.

@dasunsucharith
Created April 15, 2022 07:24
Show Gist options
  • Save dasunsucharith/2fd34e483a62a3b855588b9f0c2300d0 to your computer and use it in GitHub Desktop.
Save dasunsucharith/2fd34e483a62a3b855588b9f0c2300d0 to your computer and use it in GitHub Desktop.
My solution to CS50 2022 psets-1 mario-more
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int h;
do {
h = get_int("Height: ");
}
while (h < 1 || h > 8);
for (int i = 1; i <= h; i++){
for (int k = i; k < h; k++)
{
printf(" ");
}
for (int j=1; j<=i; j++)
{
printf("#");
}
printf(" ");
for (int l=1; l<=i; l++)
{
printf("#");
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment