Can you edit your post, I mean close the code to tags:
[code]
because forum ate all[i]
indexes and interpreted them as an italic font style.
Thanks.
At the beginning, I recommend to use dynamic array, it will save a lot of memory.
Var weight : Array of Integer;
Var value : Array of Integer;
...
Write('N: ');
Readln(n);
setlength(weight, n);
setlength(value, n);
But you will have to index from zero.