Advertisement
venom049

Mario - less

Dec 13th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <cs50.h>
  3.  
  4. int main(void)
  5. {
  6. retry:
  7.     printf("Enter hight(3-23): "); // please enter a number
  8.     int hight = get_int();
  9.     if (hight >= 3 && hight <= 23)
  10.     {
  11.         for (int i = 1; i <= hight; i++) //lines counter
  12.         {
  13.             for (int space = hight; space >= i; space--) //space counter
  14.             {
  15.                 printf(" ");
  16.             }
  17.  
  18.             for (int hash = 0; hash <= i; hash++) //hash counter
  19.             {
  20.                 printf("#");
  21.             }
  22.  
  23.             printf("\n");
  24.         }
  25.     }
  26.     else
  27.     {
  28.         goto retry;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement