They don't teach you C or java in your engineering 1st and 2nd years? I guess maybe they're throwing matlab at you?
The issue you're getting is from including a 'return' statement inside a function block (in your case main) that has a void return type - as AWOL and your compiler are trying to suggest: that don't make sense 
My suggestion is to follow racpi's advice and use a simple running average filter - my implementation is:
double LPF(double newSampleValue, double oldAverage, double alpha){
return = oldAverage + alpha * (newSampleValue - oldAverage);
}
A better version uses references to the original data and a void return type, but I omitted that for clarity.
The 'alpha' value should be between 0 and 1 - 0 will give you no change, 1 will (eventually) return the newSampleValue itself with no 'historical' effect from the oldAverage, so by varying it to say 0.9 (like in racpi's version) you'll have a reasonable 'trust' of newSampleValue but with a little left over from the oldAverage, this effectively is a Low Pass Filter, which is exactly what you want to get rid of noise. The price you pay is a delay or lag in the signal (hence PI controllers and LPF are sometimes referred to as 'phase lag').
More complex are running averages with 'windows' larger than one sample (more inherent lag, but smoother response). Even more interesting is a Kalman filter, that automagically adjusts alpha on the fly according to some mathy carry on - but given no 'dynamics' information a Kalman filter will collapse into a vanilla LPF itself. So you could say that you were actually running a first order Kalman filter (or zeroth? only just woke up, I forget which)
But don't let my technical #ank talk scare you - just look at the function, try an alpha of 0.9, write down a series of measurements on paper, e.g. 0,1,2,11,4,7,8,10,10,10,20,10,5,0 then run the code yourself, see what happens to the numbers - then try an alpha of 0.5 with the same series, note the differences.
(init the oldAverage as 0)
pretend like the 11 and the 20 were 'noise'
Pretty neat huh?