%% EXCEL EA-1 Final exam
% Problem 1: factors of a composite number
% Write a program which determines all the factors of a random integer, N,
% without using built-in MATLAB functions for this purpose (e.g.,
% "factor()"). Your program should:
% (1) work for any positive, non-zero integer
% (2) generate an array called "factors" which contains all the non-zero
% positive integers m, for which N/m produces an integer.
%
% For example, given the number N=24, your program should produce the array
% factors = [1 2 3 4 6 8 12]
%
% Hints:
% (1) What numbers do you need to check, given an integer N?
% (2) You can add an element to the array "factors" by using the notation
% "factors(end+1) = ..."
% (3) Dividing a number by one of its factors produces a number with no
% decimal, i.e. 10.000, or 42.000. Use the "round" function to help
% you check if a number is an integer.
clear; clc; close all
% Generate a random integer between 100 and 199 to test your program
N = floor(100 + 100*rand)
factors = []; % empty list to store the factors of N
% Feel free to test your program with your own value of N while debugging.
% Write your program here:
%...
% display list of factors
factors