% -----------------------------------------------------
% whileloop_writeNtimes.m
% -----------------------------------------------------
% Write a program that displays given statement N times. 
% -----------------------------------------------------
% Notes: Use a while loop.  
% -----------------------------------------------------
% Copyright and license details available at matlabmarina.com
%------------------------------------------------------

% Algorithm
% 1. define N
% 2. initialization (set counter = 0)
% 3. while loop condition (is counter < N?)
% 4. write the statement once
% 5. update counter by 1
% 6  return to step 3 if condition is false

clear;
clc;

% define N
N = 10;

% initialize counter such that the while loop condition
% is true for the 1st iteration
k = 0;

% display message until counter is equal to N
while k < N
    
    disp('I will work hard in ENGR1731/1121!');
    
    % increment counter 
    k = k + 1;
            
end

% Quiz questions: 
% What is the value of k after this program has been executed (run)? 
% Can this program be written without using a loop? 
% What happens if one does not update the counter? 
