Last active
July 16, 2020 15:15
-
-
Save aryan348/4e2909089b02d7b902b21cd33436b057 to your computer and use it in GitHub Desktop.
CS50 Problem Set 1 (Fall 2020) - Mario less
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 n; | |
do | |
{ | |
// to get height from user | |
n = get_int("Height: "); | |
} | |
// height range should be less than 8 and greater than 1 | |
while (n < 1 || n > 8); | |
for (int i = 0; i < n; i++) | |
{ | |
for (int s = 1; s<n-i; s++) | |
{ | |
printf(" "); | |
} | |
for (int j = 0; j <= i; j++) | |
{ | |
printf("#"); | |
} | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment