Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Main {
- public static void main(String[] args) {
- int[] numArray = {5, 20, 1, 2, 44, 55, 77, 88, 12, 57};
- }
- int minElement;
- int maxElement;
- public static int findMinMax(int[] numArray) {
- for(int i=0; i<numArray.length; i++) {
- for(int j=1; j<numArray.length; j++) {
- if(numArray[i] > numArray[j]) {
- maxElement = numArray[i];
- } else if(numArray[i] < numArray[j]) {
- minElement = numArray[j];
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement