Advertisement
brycewcole

HW_matlab

Oct 4th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.37 KB | None | 0 0
  1. width = input('Rows: ');
  2. height = input('Collums: ');
  3. height = (height * 2)
  4.  
  5. for y = 0 : 1 : height
  6.     for x = 0 : 1 : width
  7.         if x == width
  8.             if mod(y,2) == 1
  9.                 fprintf('|')
  10.             else
  11.                 fprintf('+')
  12.             end
  13.         else
  14.             if mod(y,2) == 1
  15.                 fprintf('|         ')
  16.             else
  17.                 fprintf('+---------')
  18.             end
  19.         end
  20.     end
  21.     fprintf('\n');
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement