Cody

Problem 2498. Whole Number Concatenator

Solution 2876705

Submitted on 25 Aug 2020 by Ramesh Kumar V
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
a=111; b=444; N_correct=111444; assert(isequal(numcat(a,b),N_correct))

m = 2 z = [] z1 = 111 z2 = '111' z = '111' z1 = 444 z2 = '444' z = '111444' N = 111444

2   Pass
a=1; b=2; c=3; d=4; f=5; N_correct=12345; assert(isequal(numcat(a,b,c,d,f),N_correct))

m = 5 z = [] z1 = 1 z2 = '1' z = '1' z1 = 2 z2 = '2' z = '12' z1 = 3 z2 = '3' z = '123' z1 = 4 z2 = '4' z = '1234' z1 = 5 z2 = '5' z = '12345' N = 12345

3   Pass
a=2; b=3; c=5; d=7; f=11; g=13; h=17; k=19; l=23; m=29; n=31; N_correct=235711131719232931; assert(isequal(numcat(a,b,c,d,f,g,h,k,l,m,n),N_correct))

m = 11 z = [] z1 = 2 z2 = '2' z = '2' z1 = 3 z2 = '3' z = '23' z1 = 5 z2 = '5' z = '235' z1 = 7 z2 = '7' z = '2357' z1 = 11 z2 = '11' z = '235711' z1 = 13 z2 = '13' z = '23571113' z1 = 17 z2 = '17' z = '2357111317' z1 = 19 z2 = '19' z = '235711131719' z1 = 23 z2 = '23' z = '23571113171923' z1 = 29 z2 = '29' z = '2357111317192329' z1 = 31 z2 = '31' z = '235711131719232931' N = 2.3571e+17

Suggested Problems

More from this Author9

Community Treasure Hunt

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

Start Hunting!