Program to find average of elements of a 2D array

Program

#include <stdio.h>
int main()
{
    printf("****************************************************");
    printf("\n****************************************************");
    printf("\n** WAP to find average of elements of a 2D array  **");
    printf("\n**            Created by Sheetal Garg             **");
    printf("\n**            Assistant Professor                 **");
    printf("\n**            Phone No:9467863365                 **");
    printf("\n****************************************************");
    printf("\n****************************************************\n");
    int m, n, i, j, a[5][5];
    float avg, sum = 0;
    printf("Enter no. of rows and columns in the array\n");
    scanf("%d%d", &m, &n);
    printf("enter array elements\n");
    for (i = 0; i < m; i++)
        for (j = 0; j < n; j++)
        {
            scanf("%d", &a[i][j]);
            sum = sum + a[i][j];
        }
    printf("\nThe array elements are\n");
    for (i = 0; i < m; i++)
    {
        for (j = 0; j < n; j++)
            printf("%d\t", a[i][j]);
        printf("\n");
    }
    avg = sum / (m*n);
    printf("\nThe average of elements is %f", avg);
    return 0;
}

Output

****************************************************
****************************************************
** WAP to find average of elements of a 2D array  **
**            Created by Sheetal Garg             **
**            Assistant Professor                 **
**            Phone No:9467863365                 **
****************************************************
****************************************************
Enter no. of rows and columns in the array
3
3
enter array elements
2 3 1
2 4 2
2 4 3

The array elements are
2       3       1
2       4       2
2       4       3

The average of elements is 2.555556
error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.