Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. Consider the following code block: spring-holidays [.Nowruz,;. Purin,,, penta

ID: 3604666 • Letter: 4

Question


4. Consider the following code block: spring-holidays [.Nowruz,;. Purin,,, pentacost. ;,Chinese New Year'); = for k 1:length(spring-holidays) disp(spring holidays (k) NowrU2 Purim Pentacost end You would like the output to appear as shown here-> However, there are three errors (one runtime, two logic) preventing this display Edit the original code block so the output appears correctly. Do NOT use a cell array. To edit the code,you may a) cross out and rewrite, b) circle errors and write corrections nearby, or c) some combination of the above, so long as your work is legible. Using a cell array instead of a rectangular matrix, rewrite the code block shown in Question 4 to produce the same output. 5.

Explanation / Answer

4.Ans)

spring_holidays = ['Nowruz';'Purim';'Pentacost';'Chinese New Year'];

printf ('this is the output')
printf(' ')
spring_holidays

5.Ans)

spring_holidays = {'Nowruz';'Purim';'Pentacost';'Chinese New Year'};

for k = 1 : size(spring_holidays)
spring_holidays{k}
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote