Skip to content
Snippets Groups Projects
module2_functions.m 442 B
Newer Older
  • Learn to ignore specific revisions
  • vand's avatar
    vand committed
    hours = 5;
    minutes = 15;
    converted = convert_time(hours,minutes);
    disp(converted)
    
    
    % Instead of writing function from scratch, you should first implement the 
    % functionality, as in the code below. 
    minutes_in_hour = 60;
    mnt = minutes/minutes_in_hour;
    total = hours + mnt;
    
    % Then, you can pack it in the function. 
    
    function total = convert_time(hours,minutes)
    minutes_in_hour = 60;
    mnt = minutes/minutes_in_hour;
    total = hours + mnt;
    end