%Find the smallest even integer that is
% divisible by 13 and whose
% square root is greater than 86
clc;
clear;
x=15;
a=rem(x,26);
b=sqrt(x);
while a==0 && b>86
if a==0 && b>86
fprintf('The required number is %d\n',x);
break
else
x=x+1;
end
end

 採用された回答

Matt Gaidica
Matt Gaidica 2020 年 12 月 15 日
編集済み: Matt Gaidica 2020 年 12 月 15 日

1 投票

At the risk of doing someones homework :P
clc;
clear;
x = 0; % or start at x = 86^2;
while true
a = rem(x,13);
b = sqrt(x);
if a==0 && b>86
fprintf('The required number is %d\n',x);
break;
else
x=x+2;
end
end

1 件のコメント

anand jangid
anand jangid 2020 年 12 月 15 日
thanks man.Now it is working.

サインインしてコメントする。

その他の回答 (2 件)

David Hill
David Hill 2020 年 12 月 15 日

2 投票

a=7397;
while ~(mod(a,13)==0&&mod(a,2)==0)
a=a+1;
end
KSSV
KSSV 2020 年 12 月 15 日

2 投票

x = 2 ;
while ~(mod(x,13) == 0 && sqrt(x)>=86)
x = x+2 ;
end
fprintf('The required number is %d\n',x);
The required number is 7410

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2020b

タグ

質問済み:

2020 年 12 月 15 日

編集済み:

2020 年 12 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by