Created
December 24, 2023 18:28
-
-
Save mounicasrinivas/c003811fdd43c0d3c565cd787e853d87 to your computer and use it in GitHub Desktop.
Maximum Value In An Array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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