Онлайн компилятор C

#include <stdio.h> int main() { int A[5]; int sum = 0; for (int i = 0; i < 5; i++) { scanf("%d", &A[1]); sum = sum + A[i]; } float average = sum / 5.0; printf("%.3f\n", average); return 0; }
This code reads five integers into an array, calculates their sum, and prints the average with three decimal places. However, there is a mistake in how the array elements are filled.

- The `scanf` call uses `&A[1]` instead of `&A[i]`, so every input is stored only in the second element of the array, leaving the other elements uninitialized. This causes the sum to be incorrect because `A[i]` for other indices reads garbage values.
- Check the index inside the loop: the variable `i` should be used to access each position of the array, not a fixed number like `1`.