Program to find minimum of elements of an array

Program (Without Using Function)

#include <stdio.h>
int main()
{
    printf("**************************************************************");
    printf("\n**************************************************************");
    printf("\n**       WAP to find minimum element from an array          **");
    printf("\n**             Created by Sheetal Garg                      **");
    printf("\n**               Assistant Professor                        **");
    printf("\n**               Phone No:9467863365                        **");
    printf("\n**************************************************************");
    printf("\n**************************************************************\n");
    int n, i, a[10], min;
    printf("Enter no. of elements in the array\n");
    scanf("%d", &n);
    printf("enter array elements");
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    min = a[0];
    for (i = 1; i < n; i++)
        if (a[i] < min)
            min = a[i];
    printf("Minimum of elements of array is %d", min);
    return 0;
}

Output

**************************************************************
**************************************************************
**       WAP to find minimum element from an array          **
**             Created by Sheetal Garg                      **
**               Assistant Professor                        **
**               Phone No:9467863365                        **
**************************************************************
**************************************************************
Enter no. of elements in the array
7
enter array elements
76
65
45
11
12
21
23
Minimum of elements of array is 11

Program (Using Function)

#include <stdio.h>
int findmin(int a[], int n)
{
    int min,i;
    min = a[0];
    for (i = 1; i < n; i++)
        if (a[i] < min)
            min = a[i];
    return min;
}
int main()
{
    printf("**************************************************************");
    printf("\n**************************************************************");
    printf("\n**       WAP to find minimum element from an array          **");
    printf("\n**             Created by Sheetal Garg                      **");
    printf("\n**               Assistant Professor                        **");
    printf("\n**               Phone No:9467863365                        **");
    printf("\n**************************************************************");
    printf("\n**************************************************************\n");
    int n, i, a[10], min;
    printf("Enter no. of elements in the array\n");
    scanf("%d", &n);
    printf("enter array elements");
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    min = findmin(a, n);
    printf("Minimum of elements of array is %d", min);
    return 0;
}

Output

**************************************************************
**************************************************************
**       WAP to find minimum element from an array          **
**             Created by Sheetal Garg                      **
**               Assistant Professor                        **
**               Phone No:9467863365                        **
**************************************************************
**************************************************************
Enter no. of elements in the array
7
enter array elements
76
65
45
11
12
21
23
Minimum of elements of array is 11
error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.