If you're trying to oversample the ADC reading, that is not the way to do it: you should only divide the result sum by 20 once, outside the loop.normally adc reading are as
if its rightCode:result = 0; for (i=0;i<20;i++) { set_adc_channel(0); delay_ms(1); result=result+read_adc(); result = result/20 ; }