SabirSazzad

Triangle print (Vartical)

Feb 20th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. int main ()
  3. {
  4.     int rows,star,spaces;
  5.     /* x = number of stars */
  6.     /* y = number of rows */
  7.     int x = 6;
  8.     int y = x;
  9.     for(rows=1;rows<=y;rows++)
  10.     {
  11.         for(spaces=1;spaces<=x;spaces++)
  12.         {
  13.             printf(" ");
  14.         }
  15.         for(star=1;star<=rows;star++)
  16.         {
  17.             printf("#");
  18.             printf(" ");
  19.         }
  20.         printf("\n");
  21.         x = x-1;
  22.     }
  23.     return 0;
  24.  
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment