Created
May 20, 2018 16:44
-
-
Save jcoryalvernaz/da2cb4dd21156f5383929799a30a96ed to your computer and use it in GitHub Desktop.
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
#include <stdio.h> | |
#include <cs50.h> | |
int main(void) | |
{ | |
//Make variables for height, spaces, and hashes | |
int height; | |
int spaces; | |
int hashes; | |
int hashesSecond; | |
//Prompt user for height | |
do | |
{ | |
height = get_int("Height: "); | |
} | |
//Set conditions | |
while (height < 0 || height > 23); | |
//Set rows | |
for (int i = 1; i <= height; i++) | |
{ | |
//Set columns of spaces | |
for (spaces = (height - (i)); spaces > 0; spaces--) | |
{ | |
printf(" "); | |
} | |
//Set columns of hashes | |
for (hashes = 1; hashes <= i; hashes++) | |
{ | |
printf("#"); | |
} | |
printf(" "); | |
for (hashesSecond = 1; hashesSecond <= i; hashesSecond++) | |
{ | |
printf("#"); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment