Advertisement
cawchamp

Untitled

Oct 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. /* This is my program of mario */
  2.  
  3.  
  4. #include <stdio.h>
  5. #include <cs50.h>
  6.  
  7.  
  8.  
  9. int main(void) //the main program
  10.  
  11. {
  12. int h, j, v; //Declaring variables
  13.  
  14. do
  15.  
  16. {
  17. printf("how height \n Height: "); //asking the user how heigh he wants his pyramid
  18. h = GetInt(); // get the number and save it to h = height
  19. }
  20.  
  21.  
  22.  
  23.  
  24. while (h<0 || h>23 );
  25. for (j=h+2; j>=1; j--)
  26. {
  27. for (v =3; v<=h+2; v++)
  28. if (v < j)
  29. printf(" ");
  30. else
  31. printf("#");
  32. printf("\n");
  33.  
  34.  
  35.  
  36.  
  37. }
  38.  
  39. return 0;
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement