Question: If we instead wanted to print from the bottom left to the top right, what would the criteria of the elements that fall on the
If we instead wanted to print from the bottom left to the top right, what would the criteria of the elements that fall on the diagonal beselect all that will match the criteria of elements that should be printed
In this week's lecture we looked at the schema of looking at each element of a D array, checking if the element matched a criteria and then taking some action if it matched like printing it The general pattern for this was:
rows cols sizeM
look at each row
for r :rows
look at all the columns in this row
for c :cols
if meets criteria
doaction
end
end
end
a condition for identifying the elements that fall on the right diagonal starting from top right and going to bottom left is:
if c cols r
dispMrc;
end
If we instead wanted to print from the bottom left to the top right, what would the criteria of the elements that fall on the diagonal beselect all that will match the criteria of elements that should be printed
r c cols
r c
r c cols
r c
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
