Solution_Assgn_3.pdf - Assignment 3 Sample solutions...

This preview shows page 1 - 2 out of 2 pages.

% Assignment 3 - Sample solutions% Question 1for a = 5:5:50fprintf("%i ", a)end5 10 15 20 25 30 35 40 45 50 % Question 2for a = 25:-5:5fprintf("%i ", a)end25 20 15 10 5 % Question 3a = 30:-5:-10;sum = 0;i = 1;while i <= length(a)if a(i) > 0sum = sum + a(i);endi = i + 1;endfprintf("%i ", sum)105 % Question 4sum = 0;for a = 30:-5:-10if a > 0 sum = sum + a; elsecontinueendendfprintf("%i ", sum)105 % Question 5prompt =

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture