### Weirdo

``` PROGRAM WEIRDO; USES CRT; VAR N:INTEGER; TMP:INTEGER; I:INTEGER; J:INTEGER; A:ARRAY[1..7] OF INTEGER; BEGIN A[1]:=1;A[2]:=3;A[3]:=5;A[4]:=7;A[5]:=6;A[6]:=4;A[7]:=2; N:=7; J:=A[N]; FOR I:=1 TO N-1 DO BEGIN TMP:=A[J]; A[J]:=J; J:=TMP; END; WRITELN('RESULT IS'); FOR I:=1 TO N DO BEGIN WRITE(A[I],' '); END; END. ```
What the heck you’ll say… I’ll tell you later…
Here I go, this was just posted after a lengthy study about data structures & algoirthms. And this was just an implementation to one of the possible questions that could have came out in the exam. And the question is, A word is getting scrambled using an array like this {1, 3, 5, 7, 6, 4, 2 } (N=7) such that odd numbers are written from start of the array to the middle whereas even numbers from the end of the array to the middle. unscramble a word given, without using a secondary array.
— Btw, question not asked…

## 3 thoughts on “Weirdo”

1. Yay Pascal, what a long time it’s been.. 😉

2. mo27772mo says:

Is fe100 dead?

3. Well, what else do you expect from FE100 to do? It’s just a messy port of tachtig & twintig by segher…