fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int n, row, c, ini, r, p, temp;
  6.  
  7.  
  8. printf("Type width of the frame 6 < x < 30 :\n");
  9. scanf("%d",&ini);
  10.  
  11. n = ini/2;
  12. temp = n;
  13. p = 1;
  14.  
  15.  
  16.  
  17. for ( row = 1 ; row <= n ; row++ )
  18. {
  19. for ( c = 1 ; c < temp ; c++ )
  20. printf("B");
  21.  
  22. temp--;
  23.  
  24. for ( c = 1 ; c <= 2*row - 1 ; c++ )
  25. printf("*");
  26.  
  27.  
  28. for (r = (n*2 - n+p); r < n*2 ; r++)
  29. printf("B");
  30. p = (p+1);
  31.  
  32. printf("\n");
  33.  
  34. }
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 9432KB
stdin
20
stdout
Type width of the frame 6 < x < 30 :
BBBBBBBBB*BBBBBBBBB
BBBBBBBB***BBBBBBBB
BBBBBBB*****BBBBBBB
BBBBBB*******BBBBBB
BBBBB*********BBBBB
BBBB***********BBBB
BBB*************BBB
BB***************BB
B*****************B
*******************