function example(n)
clc
y = n;
for i = 1:1:length(y)
for j = 1:1:length(y)
while y(i) == sqrt(y(j))
fprintf('true\n');
return
end
while y(i) ~= sqrt(y)
fprintf('false\n');
return
end
end
end
% my code runs successfully in matlab
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
a = [2 3 4];
assert(isequal(isItSquared(a),true))
true
|
2 | Fail |
a = [20:30];
assert(isequal(isItSquared(a),false))
false
|
3 | Pass |
a = [1];
assert(isequal(isItSquared(a),true))
true
|
4 | Pass |
a = [6 10 12 14 36 101];
assert(isequal(isItSquared(a),true))
true
|
5 | Fail |
a = [6 10 12 14 101];
assert(isequal(isItSquared(a),false))
false
|
Given an unsigned integer x, find the largest y by rearranging the bits in x
780 Solvers
309 Solvers
321 Solvers
530 Solvers
Switch matrix to a column vector
260 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!