フィルターのクリア

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'

1 回表示 (過去 30 日間)
Samuel Walker
Samuel Walker 2021 年 3 月 7 日
閉鎖済み: Matt J 2021 年 3 月 7 日
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 件)

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by