Last active
July 16, 2020 15:15
-
-
Save aryan348/66b7399fa81b0b2a0a8048f78cd467b6 to your computer and use it in GitHub Desktop.
CS50 Problem Set 1 (Fall 2020) - Mario More
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 | |
{ | |
n = get_int("Height: "); | |
} | |
while (n < 1 || n > 8); | |
for (int i = 0; i < n; i++) | |
{ | |
// pyramid 1 space | |
for (int s = 1; s < n - i; s++) | |
{ | |
printf(" "); | |
} | |
// pyramid 1 | |
for (int j = 0; j <= i; j++) | |
{ | |
printf("#"); | |
} | |
// space in between | |
for (int stwo = 0; stwo < 2; stwo++) | |
{ | |
printf(" "); | |
} | |
// Pyramid 2 | |
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