Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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 vue (au cours des 30 derniers jours)
ARAH MIZORI
ARAH MIZORI le 30 Août 2021
Clôturé : John D'Errico le 30 Août 2021
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

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by