Advertisement
Guest User

wsh

a guest
Nov 25th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. void x(int h);
  4. int main()
  5. {
  6.         int h;
  7.         scanf("%d", &h);
  8.  
  9.         x(h + 1);
  10.  
  11.         return EXIT_SUCCESS;
  12. }
  13.  
  14. void x(int h)
  15. {
  16.     int tabl[h][h];
  17.         for (int x = 0; x < h; ++x) {
  18.  
  19.         for (int y = 0; y < h; y++)
  20.         {
  21.             if(y == x || y == ( h - x ))
  22.             {
  23.  
  24.               tabl[x][y] = '*';
  25.  
  26.  
  27.             }
  28.             else{
  29.                 tabl[x][y] = ' ';
  30.             }
  31.  
  32.         }
  33.     }
  34.      for (int x = 1; x < h; ++x) {
  35.                 for (int y = 0; y < h; ++y) {
  36.                     printf("%c", tabl[x][y]);
  37.                 }
  38.                 printf("\n");
  39.         }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement