Problem 43283. Subtract integers and add doubles

Solution 1018822

Submitted on 16 Oct 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Fail
a = int8(1); b = int8(2); c = intOrfloat(a, b) assert(isequal(c,-1)) a = 1; b = 2; c = intOrfloat(a, b) assert(isequal(c,3)) a = uint8(1); b = uint8(2); c = intOrfloat(a, b) assert(isequal(c,0)) a = int16(100); b = int16(200); c = intOrfloat(a, b) assert(isequal(c,-100)) a = single(100); b = single(200); c = intOrfloat(a, b) assert(isequal(c,300))

Error: File: solution.m Line: 2 Column: 10 Expression or statement is incorrect--possibly unbalanced (, {, or [.

Suggested Problems

More from this Author15

Community Treasure Hunt

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

Start Hunting!