function y = your_fcn_name(x)
if (~isinf(x) && fix(x)==x)
y=1
else
y=0
end
end
function y = your_fcn_name(x)
if abs(round(x)-x)==0
y=1;
else
y=0;
end
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
x = 15;
y_correct = 1;
assert(isequal(your_fcn_name(x),y_correct))
ans =
1
|
2 | Pass |
%%
x = 15.25;
y_correct = 0;
assert(isequal(your_fcn_name(x),y_correct))
ans =
0
|
3 | Pass |
%%
x = 10;
y_correct = 1;
assert(isequal(your_fcn_name(x),y_correct))
ans =
1
|
Is my wife right? Now with even more wrong husband
1241 Solvers
519 Solvers
Check if number exists in vector
4466 Solvers
Find nearest prime number less than input number
268 Solvers
Back to basics - mean of corner elements of a matrix
297 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!