> For the complete documentation index, see [llms.txt](https://educacion.gitbook.io/programacion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://educacion.gitbook.io/programacion/exercicios-java/ud2-exercicios/arrays/introduccion-arrays.md).

# Introducción Arrays

1. Indica cal e o resultado de executar as seguinte código, e explica cal é o cálculo que fai.

```java
public static void main(String[] args){
        int [] a = {10,21,37,40,51};
        int p=0,i=0;
        for (int x=0;x<a.length;x++)
            if (x%2==0)
                p+=a[x];
            else
                i+=a[x];
        System.out.println(p + " - " + i);
    }
```

2. Indica cal e o resultado de executar as seguinte código, e se é necesario fai correccións para que funcione correctamente. Saida: 20,30,40,50,10

```java
public static void main(String[] args){
        int [] arr = new int [5] {10,20,30,40,50};
        for (int i=0; i<= arr.length()-1;i=+1)
            arr[i]=arr[i+1];
        for (int i=0; i<= arr.length()-1;i=+1)
            System.out.println(arr[i]);
    }
```

3. Realiza un programa que defina un array denominado temperaturaMeses, de 12 enteros, coas temperaturas medias na Coruña. O programa realizará o seguinte:
   1. Inicializará o Array con numeros aleatorios entre 0 e 40 que representan a temperatura
   2. Mostrará por pantalla o contenido do Array de temperaturas
4. Realiza un programa que defina un array denominado notasAlumnos, onde se almacena a nota da asignatura de programación de 20 alumnos. O programa realizará o seguinte:
   1. Inicializará o Array con numeros aleatorios (double) con un decimal
   2. Mostrará todas as notas de cada alumno
   3. Mostrará a media, a nota maior e a nota menor


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://educacion.gitbook.io/programacion/exercicios-java/ud2-exercicios/arrays/introduccion-arrays.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
