I did not bother to name this...

From Soft Horse, 1 Week ago, written in Plain Text, viewed 17 times.
URL http://codebin.org/view/0cbf0239 Embed
Download Paste or View Raw
  1. //Prints a full pyramid
  2.  
  3. #include <cs50.h>
  4. #include <stdio.h>
  5.  
  6. int main(void)
  7. {
  8.     int n;
  9.     do
  10.     {
  11.         n = get_int("Please enter a number between 0-23: ");
  12.     }
  13.     while (n > 23 || n < 0); //Checks for a valid input
  14.  
  15.     for (int i = n - 1; i >= 0; i--) //Initial Loop
  16.     {
  17.         int k = i;
  18.         for (int j = n - i; j > 0; j--)
  19.         {
  20.             while (k > 0) //Prints spaces equal to height of the pyramid (i) -1
  21.             {
  22.                 printf(" ");
  23.                 k--;
  24.             }
  25.             printf("#");
  26.         }
  27.         printf("  "); //Prints two spaces between the pyramids
  28.         for (int j = n - i; j > 0; j--)
  29.         {
  30.             printf("#");
  31.         }
  32.         printf("\n");
  33.     }
  34. }

Reply to "I did not bother to name this..."

Here you can reply to the paste above