SHARE
TWEET

Mario.C

a guest May 5th, 2017 78 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.     do
  8.     {
  9.         printf("Height: ");
  10.         height = get_int();
  11.     } while (height < 0 || height > 23);
  12.    
  13.     for (int i = 0; i < height; i++)
  14.     {
  15.         for (int j = 0; j < height - i - 1; j++)
  16.         {
  17.             printf("%s", " ");
  18.         }
  19.         for (int k = 0; k < i + 2; k++)
  20.         {
  21.             printf("#");
  22.         }
  23.         printf ("\n");
  24.     }
  25. }
RAW Paste Data
Top