#### The maximum** and minimum element of the array:-**This program will print the biggest and the smallest element with its respective indexes(subscript)

**To learn more array programshttps://java4school.com/sum-of-boundary-elements-of-a-matrix**

```
class maxmin{
public static void main(){
int arr[]={3,5,78,23,56,90,12,34,1,6,88,65,46,28,72,12};
System.out.println("The array is:");
int l=arr.length; for(int i=0;i<l;i++){
System.out.print(arr[i]+" ");
}
int min=arr[0];
int max=arr[l-1];
int mxp=0,mnp=0;
for(int i=0;i<l;i++){
if(arr[i]>max){
max=arr[i];
mxp=i;
}
}
for(int j=0;j<l;j++){
if(arr[j]<min){
min=arr[j];
mnp=j;
}
}
System.out.println("\nmax:"+max+" at position"+mxp);
System.out.println("min:"+min+" at position "+mnp);
}
```

**Output:- **

The array is:

3 5 78 23 56 90 12 34 1 6 88 65 46 28 72 12

The Maximum number is:90 at position 5

The minimum number is:1 at position 8

**For videos related to java programming http://www.youtube.com/user/trushnatej **