Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
find the integer multiple of 3 whose square is closest to but lower than or equal to a number entered by the user. Replace lines 5-11, use a while loop but I'm not meant to use 'if' or 'floor'
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
clear
value=input('Enter a number ');
for i = 1:value    
    if rem(i,3) == 0 && i*i <= value        
        j=i;    
    else
        break;    
    end
end
fprintf('The integer multiple of 3 that is less than or equal to the square root of%f is %d\n', ...         
    value, j);
댓글 수: 0
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
