I want to be able to print a diamond like this when the user enters 5 for the diamond. But also will work for any value that is odd and greater than 0.
clear all, clc
n=input('Input an Odd Number ');
for i=1:(n+1)/2
for m=1:(n+1)/2-i
fprintf(' ');
end
for j=1:(2*i)-1
fprintf('*');
end
fprintf('\n');
end
for k=i-1:-1:1
for m=1:(n+1)/2-k
fprintf(' ');
end
for j=1:(2*k)-1
fprintf('*');
end
fprintf('\n');
end