Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How do I only result in 5 answers (I want the matrix to times 1 by 1 and 2 by 2 and 3 by 3 etc. not 1 by 1 and 1 by 2 and 1 by 3 etc.)

1 visualización (últimos 30 días)
s = 1;
s1 = input('Enter the number of columns : ');
h = 1;
h1 = input('Enter the number of columns : ');
for p = 1:s
for c=1:s1
fprintf('Enter the value in row %d column %d\n',p,c);
M(p,c)=input('');
end
end
disp(M)
for i = 1:h
for j = 1:h1
fprintf('Enter the value in row %d column %d\n',i,j);
M1(i,j)=input('');
end
end
disp(M1)
for i = 1:5
for j = 1:5
s1 = M(i);
h1 = M1(j);
SA = ((sqrt(3)./2) * s1^2 + 3*s1*h1);
fprintf ("\nTotal surface area of equilateral triangular prism is %f\n",SA)
end
end

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by