😉 This is the program of Find Maximum and Minimum Element in Arrays very good and easy way I am doing this code.
package ds.Arrays;
public class Find_The_Max_Min_Element_In_Array {
public static void main(String[] args) {
int arr[]=new int[] {10,20,30,40,60,3};
int max=-65535,min=65536;
for (int i = 0; i < arr.length; i++) {
if(arr[i]>max)
max=arr[i];
if(arr[i]<min)
min=arr[i];
}
System.out.println("Max :"+max+"\t Min:"+min);
}
}
Comments
Post a Comment