Advertisement
cd62131

after refactoring

Oct 19th, 2013
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(void) {
  3.     int H, W, m, n;
  4.     while (1) {
  5.         scanf("%d%d", &H, &W);
  6.         if (H == 0 || W == 0) { break; }
  7.         m = n = 1;
  8.         while (m <= H && n <= W) {
  9.             if (m != 1 && m != H && n != 1 && n != W) {
  10.                 printf("."); n++; continue;
  11.             }
  12.             printf("#");
  13.             // tail? then newline
  14.             if (n == W) { printf("\n"); n = 1; m++; }
  15.             else { n++; }
  16.         }
  17.         printf("\n");
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement