Write a function called freezing that takes a vector of numbers that correspond to daily low temperatures in Fahrenheit. Return numfreeze, the number of days with sub freezing
이전 댓글 표시
Please help!
3 is correct for Test 1, but I am going crazy trying to figure out why 5 is incorrect for Test 2.
function numfreeze = freezing(a)
numfreeze = sum(a>=32);
end

댓글 수: 2
Manikanta Aditya
2024년 5월 30일
Can you share more information?
John D'Errico
2024년 5월 30일
So, its giving you the cold shoulder, is it?
Conveniently, the first test had 3 temps below, and 3 at or above. So the first test could not go wrong. But @James Tursa gave you the correct response. Look carefully at your code, and think about whether you want to know if the temp is above, or below 32.
답변 (1개)
James Tursa
2024년 5월 30일
2 개 추천
Hint: Is it freezing when the temperature is above 32 or below 32? And what have you coded?
카테고리
도움말 센터 및 File Exchange에서 Software Development에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!