daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Jan 20th, 2018 55 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. #include <stdio.h>
  2. #include <cs50.h>
  3.  
  4. int main(void)
  5. {
  6.  
  7.     int height;
  8.     int space;
  9.     int hash;
  10.  
  11.  
  12.     do
  13.     {
  14.         printf( "Pyramid Height:" );
  15.         height = get_int();
  16.     }
  17.  
  18.     while ( height <= 0 || height > 23 );
  19.  
  20.  
  21.     for ( int i = 0; i < height; i++ )
  22.     {
  23.  
  24.         for ( space = ( height - 1 - i ); space > 0; space-- )
  25.         {
  26.             printf( " " );
  27.         }
  28.  
  29.         for ( hash = 1; hash <= ( i + 1 ); hash++ )
  30.         {
  31.             printf( "#" );
  32.         }
  33.  
  34.         printf( "  " );
  35.  
  36.         for ( hash = 1; hash <= ( i + 1 ); hash++ )
  37.         {
  38.             printf( "#" );
  39.         }
  40.  
  41.         printf( "\n" );
  42.     }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top