Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cs50.h>
- int main(void)
- {
- int height;
- int space;
- int hash;
- do
- {
- printf( "Pyramid Height:" );
- height = get_int();
- }
- while ( height <= 0 || height > 23 );
- for ( int i = 0; i < height; i++ )
- {
- for ( space = ( height - 1 - i ); space > 0; space-- )
- {
- printf( " " );
- }
- for ( hash = 1; hash <= ( i + 1 ); hash++ )
- {
- printf( "#" );
- }
- printf( " " );
- for ( hash = 1; hash <= ( i + 1 ); hash++ )
- {
- printf( "#" );
- }
- printf( "\n" );
- }
- }
Add Comment
Please, Sign In to add comment