Created
July 25, 2018 22:56
-
-
Save toshvelaga/73005483d3dadbd83e433beedd4da49e to your computer and use it in GitHub Desktop.
CS50 Mario More
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 solution. Feel free to check with any online compiler. To get credit from Harvard you may have to make a few changes. | |
hmu at s.velaga@uky.edu if you have any questions. */ | |
#include <stdio.h> | |
int main( ) | |
{ | |
int h; | |
printf("Enter a number between 0 and 23 to create a pyramid!\n"); | |
scanf("%d", &h); | |
printf("You entered: %d\n\n", h); | |
if (h<=23 && h>0) | |
{ | |
int a, b, c, d, e, f; | |
for (a=1;a<=h;a++) | |
{ | |
for (b=a;b<h;b++) | |
{ | |
printf(" "); | |
} | |
for (c=1;c<=a;c++) | |
{ | |
printf("#"); | |
} | |
for (d=1;d<=2;d++) | |
{ | |
printf(" "); | |
} | |
for (e=1;e<=a;e++) | |
{ | |
for(f=1;f<=1;f++) | |
{ | |
printf("#"); | |
} | |
} | |
printf("\n"); | |
} | |
} | |
else | |
{ | |
printf("\nTry Again Friend! You gotta enter a number between 0 and 23"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment