Skip to content

Instantly share code, notes, and snippets.

@teeschorle
Last active December 22, 2019 23:12
Show Gist options
  • Save teeschorle/edc52911ef6ccb4c70ffae9c0a3071f9 to your computer and use it in GitHub Desktop.
Save teeschorle/edc52911ef6ccb4c70ffae9c0a3071f9 to your computer and use it in GitHub Desktop.
CS50 Problem Set 1 (Fall 2019) - Mario (2)
//CS50 Problem Set 1 (Fall 2019): Mario
//Author: teeschorle
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int height;
do
{
height = get_int("Height: ");
}
while (height > 8 || height < 1);
// going from row to row
for (int i = 0; i < height; i++)
{
// going from character to character (in each row)
for (int j = 0; j < 2 * height + 2; j++)
{
if (j < height - 1 - i || j > height + 2 + i || j == height || j == height + 1)
{
printf(" ");
}
else
{
printf("#");
}
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment