Skip to content

Instantly share code, notes, and snippets.

@mounicasrinivas
Created December 24, 2023 18:28
Show Gist options
  • Save mounicasrinivas/c003811fdd43c0d3c565cd787e853d87 to your computer and use it in GitHub Desktop.
Save mounicasrinivas/c003811fdd43c0d3c565cd787e853d87 to your computer and use it in GitHub Desktop.
Maximum Value In An Array
public class MaximumValueInAnArray {
public static void main(String[] args) {
int[] a ={ -1,2,3,-4,5};
int max = Integer.MIN_VALUE;
for(int i = 0; i <a.length; i++){
if (a[i] > max){
max = a[i];
}
}
System.out.println(max);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment