MATLAB: Nested Loop Script (Triangle) nested loopscript Write a nested llop script that will print the following pattern, printing one number or character at a time starting at 1 and using the numbers 0 through 9 Best Answer Here is the complete answer to all parts of the assignment:%%clearvars; clc%% Part 1.k=1;for ii = 1 : 5 for jj = 1 : ii if k >10 k=k-10; fprintf(num2str(k)); else fprintf(num2str(k)) ; end k = k+1; end fprintf('\n') ;end%% Part 2k = 65 ;for ii = 1 : 5 for jj = 1 : ii fprintf(char(k)) ; k = k + 1 ; end fprintf('\n') ;end%% Part 3. Numbersk=5;for ii = 1 : 5 for jj = 1 : ii if k >10 k=k-10; fprintf(num2str(k)); else fprintf(num2str(k)) ; end k = k+1; end fprintf('\n') ;end%% Part 3. Lettersk = 68 ;for ii = 1 : 5 for jj = 1 : ii fprintf(char(k) ) ; k = k + 1 ; end fprintf('\n') ;end Related SolutionsMATLAB: How to collect non-integers from for loop in one matrix ii=0;for k=1:.5:10ii=ii+1 y(ii)=kendork=1:.5:10for ii=1:numel(k) y(ii)=k(ii)end MATLAB: Using a “while” loop to calculate a factorial kk = 10;k = 1;f = 1;while k <= kk f = k * f; k = k + 1;endformat longdisp(f) Related QuestionCould anyone help me to overcome the error.How can i see if a unit8 var exist or notIf-else within for loopConverting for loop to while loopHow should I fix the while loop so that “Index exceeds matrix dimensions.” ? Below is the script
Best Answer