strange input values in my first helloworld

This is the first time I use Arduino. Actually it is the first time I put my hands on something that is not a pc keyboard.
The problem is (on Arduino Due):
I connected the 3.3V to a breadboard row, let's say row2. then I connected the ground to another row (row11).
I put a 100KHom resistor between GND and row7 and again row7 to row2 with another 100K resistor.
Finally I connect analog input A0 to row2 and A1 to row7 (3.3V).
What I expected was A0= row2 = 3.3V (1023) and A1= row7 = 1.62V(512).
So i wrote this simple code

void setup() {

void loop() {

and the first two loops it gives more or less a plausible result (A0=1022 and A1=593 \ A0=1023 and A1 = 527).
But starting from the 3th loop it gives very similar values i.e. A0 = 527, A1 = 528 and so on... what is happening?

I couldn’t find anything wrong about it. Try this and reply

int val1,val2;
void setup()

void loop()
  val1 = analogRead(A0);
  val2 = analogRead(A1);

thanks for replying!

I tried the code but the same thing happens. I observed that all the analog input ports give the same result as the lowest indexed port. (i.e. Ak = Ai if i>k)
I tried to change the A0 pin on the fly and it gives the right result. When I connect A0 to GND it gives 0, to row7 it gives 480 and to row2 it gives 1023 that is more or less what I was expecting.
In your opinion there can be some sort of shortcircuit between the input ports?
Is it a bad pratice to change the connectors runtime on the fly?

Try some smaller resistors and remember that 1) it takes time, albeit a fairly short time, for the ADC caps to charge. that time depends upon the amount of current feeding the analog pins. you may be sampling before full charge, 2) the value of the resistors change with thier tempreture and thus, supply vayring amounts of current, and 3) you can be picking up some stray volts from surronding electricals and electronics.

ok I tried with 200 Ohms resistors and I gave 1000ms of delay between each measurement. Same thing happens