n square

n square
0 Downloads
Updated 5 Oct 2025

View License

S = [];
for i = 1:7
S(end+1) = print_s(i);
fprintf("\n");
end
fprintf("%g^2 ",sqrt(S));
function res = print_s(n)
res = 0;
for i = 1:2:(2*n-1)
res = res + i;
fprintf("%d",i);
if(i==2*n-1)
fprintf("=");
else
fprintf("+");
end
end
fprintf("%d",res);
end

Cite As

Hoi Sing Lau (2026). n square (https://www.mathworks.com/matlabcentral/fileexchange/182207-n-square), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
1.0.0