Created
February 2, 2015 17:46
-
-
Save tudorconstantin/d8079734de75bd8e07eb to your computer and use it in GitHub Desktop.
cs50 mario pyramid
This file contains hidden or 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
| #include <cs50.h> | |
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int y; | |
| int x; | |
| int space; | |
| int hash; | |
| do { | |
| printf("alege un nr intre 0 si 23n"); | |
| y = GetInt(); | |
| } while ((y < 0) || (y > 23)); | |
| for (x = 1; x < y; x++) { | |
| for ((space = y - x); space > 0; space--) { | |
| printf(" "); | |
| } | |
| for(hash = 1; hash <=(x + 1); hash++){ | |
| printf("#"); | |
| } | |
| printf("\n"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment