I don't know how to code this number triangle
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How to Code this following number triangle below??
0 comentarios
Respuesta aceptada
KSSV
el 29 de Oct. de 2022
n = [1 11 111 1111 11111 111111 1111111];
for i = 1 : length(n)
x = num2str(n(i)^2);
s = [blanks(length(n)-i) x];
fprintf('%s\n',s)
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!