MATLAB: Use fprintf to create a multiplication table.

fprintfhomework

Create a multiplication table from 1 to 13 for the number 6. Your table should look like this.
1 times 6 is 6 2 times 6 is 12 3 times 6 is 18 . . .

Best Answer

clc
Start=6;
Stop=6;
for u=Start:Stop;
for v=1:13;
fprintf('%d times %d is %d\n',u,v,u*v)
end
fprintf('\n')
end
The code works for more than what is requested, for example create several multiplication tables
clc
Start=1;
Stop=10;
for u=Start:Stop;
for v=1:10;
fprintf('%d times %d is %d\n',u,v,u*v)
end
fprintf('\n')
end
Simple version for just what is requested
clc
for v=1:13
fprintf('%d times %d is %d\n',6,v,6*v)
end