in reply to Re: accessing variable vaule outside for loop
in thread accessing variable vaule outside for loop

Hi Michael,but its output is some type of pyramid means,when I ran your code I got

1 2 1 3 2 1 4 3 2 1 4 3 2 1

But I need reverse of it,anyway thanks for it

Replies are listed 'Best First'.
Re^3: accessing variable vaule outside for loop
by Laurent_R (Canon) on Jul 06, 2013 at 14:38 UTC

    Just remove the print statement inside the for loop, and you will no longer get this "pyramid". I think this print statement was put there just to show you how the array get progressively populated.

Re^3: accessing variable vaule outside for loop
by gaurav (Sexton) on Jul 06, 2013 at 14:57 UTC

    Thanks Michael,Its working fine

      glad to help.