how do i use the for loop for multiplication table?
Mostrar comentarios más antiguos
hi, i have tried to write the multiplication table for two, like this % multiplication table clc N = 1,2,3,4,5,6,7,8,9,10; for i = 1:N; fi=2*N; end but somehow it's not working. i don't want to use the fprintf command. please help i am new to MATLAB Thank You in advance
Respuesta aceptada
Más respuestas (2)
Chaitanya Krishna
el 3 de Sept. de 2021
0 votos
a = input('Enter a number : ')
for (i=1:10);
fprintf('%d * %d = %d\n',a,i,(a*i));
end
Himanshu Chaudhari
el 2 de Abr. de 2022
0 votos
clc
clear
close
% multiplication table
N = 1:10 ;
AI=rand(size(N));
MI=input('Please enter a value for Multiplication table=');
for i=N
AI(i)=MI*N(i);
end
multiplication_table= [N' AI']
1 comentario
Jim Liu
el 30 de Oct. de 2022
Thank you!
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!