MATLAB: To print following pattern homeworkpattern 1 x 8 + 1 = 9 12 x 8 + 2 = 98 123 x 8 + 3 = 987 1234 x 8 + 4 = 9876 12345 x 8 + 5 = 98765 123456 x 8 + 6 = 987654 1234567 x 8 + 7 = 9876543 12345678 x 8 + 8 = 98765432 123456789 x 8 + 9 = 987654321 Best Answer You mean like this?for k=1:9 a=str2double(char('0'+(1:k))); b=a*8+k; fprintf('%d x 8 + %d = %d\n',a,k,b)end Related SolutionsMATLAB: How to write a script for the following >> for k=1:9, n=sscanf(sprintf('%d',1:k),'%d'); fprintf('%d x 8 + %d = %d\n',n,k,n*8+k); end1 x 8 + 1 = 912 x 8 + 2 = 98123 x 8 + 3 = 9871234 x 8 + 4 = 987612345 x 8 + 5 = 98765123456 x 8 + 6 = 9876541234567 x 8 + 7 = 987654312345678 x 8 + 8 = 98765432123456789 x 8 + 9 = 987654321>> MATLAB: How could I write a script which iterates from 1 to 9 and performs the following operation I'd just define x in advance of the loopx = [1,12,123,1234, etc.then use x(i) and fprintf() inside the loop. Related QuestionGet rid of unwanted outputHow to creat two box plot in one graph use different dataHow to read a 1000 digit number from a text file into a matrixGet rid of unwanted output
Best Answer