Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Problem 1
- clear;clc;
- s = input('Enter the size of the square')
- while s <= 0 | s > 26
- disp('The size must be between 1 and 26')
- s = input('Try again: enter the size of the square')
- end
- a = input('Enter a single character used for the background', 's')
- Vec1 = double(a);
- while length(Vec1) > 1
- disp('Enter only a single printable character!')
- a = input('Enter the background character again', 's')
- Vec1 = double(a)
- end
- MTX(s,s) = 0
- for i = 1:s
- for j = 1:s
- if i == j
- MTX(i,j) = double('A') - j + s
- elseif i > j
- MTX(i,j) = a
- end
- end
- end
- char(MTX)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement