program Promedio; var n, i: integer; suma: real; numeros: array of real; begin writeln('¿Cuántos números desea ingresar?'); readln(n); SetLength(numeros, n); suma := 0; for i := 0 to n-1 do begin writeln('Ingrese el número ', i+1, ':'); readln(numeros[i]); suma := suma + numeros[i]; end; writeln('El promedio es: ', suma/n:0:2); end.
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter