Program to find maximum of elements of a 2-D array

Program (Without Using Function)

#include <stdio.h>
int main()
{
    printf("**************************************************************");
    printf("\n**************************************************************");
    printf("\n**       WAP to find maximum element from a 2-D  array      **");
    printf("\n**             Created by Sheetal Garg                      **");
    printf("\n**               Assistant Professor                        **");
    printf("\n**               Phone No:9467863365                        **");
    printf("\n**************************************************************");
    printf("\n**************************************************************\n");
    int r, c, i, j, a[10][10], max;
    printf("Enter no. of rows and columns in the array\n");
    scanf("%d%d", &r, &c);
    printf("enter array elements");
    for (i = 0; i < r; i++)
        for (j = 0; j < c; j++)
            scanf("%d", &a[i][j]);
    max = a[0][0];
    for (i = 0; i < r; i++)
        for (j = 0; j < c; j++)
            if (a[i][j] > max)
                max = a[i][j];
    printf("Maximum of elements of array is %d", max);
    return 0;
}

Output

**************************************************************
**       WAP to find maximum element from a 2-D  array      **
**             Created by Sheetal Garg                      **
**               Assistant Professor                        **
**               Phone No:9467863365                        **
**************************************************************
**************************************************************
Enter no. of rows and columns in the array
3
3
enter array elements
23 45 65
12 23 45 
90 98 23
Maximum of elements of array is 98

Program (Using Function)

#include <stdio.h>
int findmax(int a[][10], int r, int c);
int main()
{
    printf("**************************************************************");
    printf("\n**************************************************************");
    printf("\n**       WAP to find maximum element from a 2-D  array      **");
    printf("\n**             Created by Sheetal Garg                      **");
    printf("\n**               Assistant Professor                        **");
    printf("\n**               Phone No:9467863365                        **");
    printf("\n**************************************************************");
    printf("\n**************************************************************\n");
    int r, c, i, j, a[10][10];
    printf("Enter no. of rows and columns in the array\n");
    scanf("%d%d", &r, &c);
    printf("enter array elements");
    for (i = 0; i < r; i++)
        for (j = 0; j < c; j++)
            scanf("%d", &a[i][j]);
    printf("Minimum of elements of array is %d", findmax(a, r, c));
    return 0;
}
int findmax(int a[][10], int r, int c)
{
    int i, j, max;
    max = a[0][0];
    for (i = 0; i < r; i++)
        for (j = 0; j < c; j++)
            if (a[i][j] > max)
                max = a[i][j];
    return max;
}

Output

**************************************************************
**************************************************************
**       WAP to find maximum element from a 2-D  array      **
**             Created by Sheetal Garg                      **
**               Assistant Professor                        **
**               Phone No:9467863365                        **
**************************************************************
**************************************************************
Enter no. of rows and columns in the array
3
3
enter array elements
23 34 56 
21 23 31
45 67 87
Minimum of elements of array is 87
error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.