daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Feb 21st, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cs50.h>
  2. #include <stdio.h>
  3.  
  4. int main(void)
  5. {
  6.     int height;
  7.     int hash;
  8.     int row;
  9.     int space;
  10.    
  11.     do
  12.     {
  13.         height = get_int("Height between 1-8: ");
  14.     }
  15.    
  16.     while (height < 1 || height > 8);
  17.     {
  18.         if (height > 0 && height < 9) {
  19.             printf("Stored: %i\n", height);
  20.         }
  21.     }
  22.    
  23.     for (row = 1; row <= height; row++)
  24.     {
  25.         for (space = 0; space < height - row; space++)
  26.         {
  27.             printf(" ");
  28.         }
  29.         for (hash = 1; hash <= row; hash++)
  30.         {
  31.             printf("#");
  32.         }
  33.         printf("\n");
  34.     }
  35. }
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