Advertisement
STANAANDREY

pclab4 1

Oct 12th, 2022 (edited)
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void drawFullLine(int n) {
  4.   for (int i = 1; i <= n; i++) {
  5.     printf("*");
  6.   }
  7.   printf("\n");
  8. }
  9.  
  10. void drawEmptyLine(int n) {
  11.   printf("*");
  12.   for (int i = 2; i < n; i++) {
  13.     printf(" ");
  14.   }
  15.   printf("*\n");
  16. }
  17.  
  18. void drawEmptySection(int n) {
  19.   for (int i = 2; i <= n; i++) {
  20.     drawEmptyLine(n * 2 + 1);
  21.   }
  22. }
  23.  
  24. int main(void) {
  25.   int n;
  26.   printf("n="); scanf("%d", &n);
  27.   drawFullLine(n);
  28.   drawEmptySection(n / 2);
  29.   drawFullLine(n);
  30.   drawEmptySection(n / 2);
  31.   drawFullLine(n);
  32.   return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement