Write a short code to find the minimum, maximum, and mean value from an array of numbers and then to print those values. Array : 4, 1, 23, 25, 15, 11, 8, 19, 20, 3
clc clear x = [1, 3, 4, 8, 11, 15, 19, 20, 23, 25]; xmin = min(x); xmax = max(x); xmean = mean(x); fprintf('The minimum value is %d \n', xmin); fprintf('The maximum value is %d \n', xmax); fprintf('The mean value is %f \n', xmean);
If you have $6 to spend on candy and the small candies cost $0.25 and the large ones cost $0.75, if you get 3 large ones how many small ones can you get?
Write out equation: 6 = 0.25X + 0.75*3 X = 15 You can get 15 small candies.
You go to the bank for a loan and they offer you 3 choices $2000 at 10% interest per year, $5000 at 3.5% interest per year, and 10000 at 2% interest per year. Which loan plan would be the cheapest? Assuming $750 is paid on the loan every year with the original interest of the loan at the start added on at the end of the year, how long would it take to pay off the cheapest loan?
First thing is to find the amount of interest each loan generates per year. 2000 * 0.1 = 200; 5000 * 0.035 = 175; 10000 * 0.02 = 200; Thus the $5000 loan is the cheapest. Now setup your equation to find the number of years to pay off the loan. 0 = 5000 + (175*x) - 750*x; Solve for X. X = 8.6957 It would take approximately 8.7 years to pay off the loan. Thus going by per year it would be 9 years to pay off the loan.