-4

Q- Create a "counter" from 0:limit-1 (for example if you choose 3 it will display 0,1,2). The length of counter is not determined in the program and it should be determined when it is being run and the inputs can differ from each other

Neha Irfan
  • 1
  • 1
  • 4
  • Is this a homework problem? What have you tried so far? – am304 May 10 '13 at 08:55
  • this is the function for input vector of size 3 you, can try running it. now we have to make a counter which will run for an input vector of any size so how will it be done? this is my question:function neha(limit) c = zeros(1,3); for i = 0:limit(3)-1 % same as running it from 1:limit(3) c(3)=i; for j = 0:limit(2)-1 c(2)=j; for k=0:limit(1)-1 c(1)=k; for x=3:-1:1 fprintf('%d ',c(x)) end fprintf('\n'); end end end return – Neha Irfan May 10 '13 at 10:14

1 Answers1

1

not really sure what you mean...but

for i = 0:limit-1
    disp(i)
end

will display 0,1,2 ... limit-1

user2208392
  • 105
  • 1
  • 8