Last active
December 22, 2019 23:12
-
-
Save teeschorle/edc52911ef6ccb4c70ffae9c0a3071f9 to your computer and use it in GitHub Desktop.
CS50 Problem Set 1 (Fall 2019) - Mario (2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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