# Average of an Array

```import "dart:io";//1
main()
{
print("Enter the Size of Array");//2
var numbers=List(size);//4
for(int i=0;i<size;i++)//5
{
}
var sumofArrayElements = 0;//7
for(int i=0;i<numbers.length;i++)//8
{
sumofArrayElements+= numbers[i];//9
}
print("Average of Given Array is=\${sumofArrayElements/size}");//10
}```
1. Import statement for input and output library
2. Instruct the user to enter the size of the array
3. After converting user input into an int and then assigned to size variable
4. Create a new array(List ) of user-entered size with a variable name numbers
5. Execute for loop from 0 to less than numbers length
6. After converting user input into int and then assigned to the element of an array (initialization of Array Elements based on user input)
7. Create and initialized and sumofArrayElement variable with 0
8. Execute for loop from 0 to less than numbers length to calculate the sum of array elements
9. Add elements value in sumofArrayElements
10. Calculate and print the average of Array on Console

Output

Enter the Size of Array
4
10
20
30
40
Average of Given Array is=25.0