write a function that takes in a temp input and returns the corresponding category like freezing,cool, cold etc. for example temperatures 32-50 are cold in matlab

main.m
function category = temperatureCategory(temp)
    if temp < 32
        category = 'freezing';
    elseif temp >= 32 && temp <= 50
        category = 'cold';
    elseif temp > 50 && temp <= 70
        category = 'cool';
    elseif temp > 70 && temp <= 90
        category = 'moderate';
    else
        category = 'hot';
    end
end
332 chars
14 lines

related categories

gistlibby LogSnag