Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3.  
  4. int main(void) {
  5.     printf("height: ");
  6.  
  7.     int steps = GetInt();
  8.    
  9.     while (steps < 0 || steps > 23) {
  10.         printf("please enter a number greater than 0 and less than 23\n");
  11.         printf("height: ");
  12.         steps = GetInt();
  13.     }
  14.     int space = steps;
  15.     int hash = 1;
  16.     for(int a = 1; a <= steps; a++) {
  17.         space--;
  18.         hash++;
  19.         for(int b = 1; b <= space; b++) {
  20.             printf(" ");
  21.         }
  22.         for(int c = 1; c <=hash; c++) {
  23.             printf("#");
  24.         }
  25.         printf("\n");
  26.     }
  27.     printf("congrats u made it to the end!\n");
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement