Telaryon

E betű rajzolás

Mar 6th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int height;
  7.     int row;
  8.     int column;
  9.  
  10.     do { printf("Height (must be an odd number):\n ");
  11.         scanf("%d", &height);
  12.     } while (!(height%2));
  13.     for (row = 1; row <= height; row++) {
  14.         if (row%2) {
  15.             for (column = 1; column <= height/2+1; column++) printf(" * ");
  16.             printf("\n");
  17.         }
  18.         if (!(row%2)) {
  19.             printf(" * ");
  20.             printf("\n");
  21.         }
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment