SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 394k

program explanation ?

Oct 21 2013 3:52 PM
Hi 

Can anyone walk me through the code .. 

What does this actually script display?

if in-case any error please correct those :) 

x=3;

y=5;

i=2;

z=[4 5 2 6 3];

disp('start')

while i<=6

if (i>5)

disp('done')

elseif (i>3 &i~=5)

back1=confuse2(i,x,y,z);

back1=back1/z(i)

end

i=i+1;

end

function out1=confuse3(j,d,s,k)

switch (k(j))

case {1,2}

out1=d+5

case {3,4}

out1=2*s

otherwise

out1=d+j*j+2*s

end


function out2=confuse2(j,y,x,k)

temp=[1 1 1 1 1];

for i=j:5

temp(i)=k(i)+k(j);

end

out2=sum(temp)


The answer should be:
start

out2 = 24

back1 =4

done



Cheers mate ...
TY for support 

Answers (1)