Write a program find the largest and the smallest number from given numbers

#include<stdio.h> void arrange(int a[10], int n){ int i,j,temp; printf("Enter array element:\n"); for(i=0; i<n; i++) scanf("%d",&a[i]); for(i=0; i<n-1; i++){ for(j=i; j<n; j++){ if(a[i]>a[j]){ temp = a[i]; a[i] = a[j]; a[j] = temp; } } } } int main(){ int a[10],n; printf("Enter the size of 1d array: "); scanf("%d",&n); arrange(a,n); printf("Largest = %d\n",a[n-1]); printf("Smallest = %d\n",a[0]); return 0; }

**Output**

Enter the size of 1d array: 5

Enter array element:

2

3

1

4

5

Largest = 5

Smallest = 1