Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld{
- public static void main(String []args){
- int[] a = {3,5,6,7,1,6,8,11,1000,1,5,5,5342,56,3};
- int max = a[0];
- int min = a[0];
- for (int i = 0; i < a.length; i++) {
- if (a[i] > max) {
- max = a[i];
- }
- if (a[i] < min) {
- min = a[i];
- }
- }
- System.out.println(max);
- System.out.println(min);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement