-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanothertes.java
More file actions
36 lines (30 loc) · 897 Bytes
/
Copy pathanothertes.java
File metadata and controls
36 lines (30 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
public class anothertes {
public static void main(String[] args){
int array[] = new int[10];
Scanner input = new Scanner(System.in);
System.out.println("Give the integer Element: ");
for (int i =0;i<array.length;i++){
array[i] = input.nextInt();
}
System.out.println(getMax(array));
}
public static int getMax(int [] inputArray){
int maxValue = inputArray[0];
for (int i =1;i<inputArray.length;i++){
if(inputArray[i] >maxValue){
maxValue = inputArray[i];
}
}
return maxValue;
}
public static int getMin(int [] inputArray){
int minValue = inputArray[0];
for (int i =1;i<inputArray.length;i++){
if(inputArray[i]<minValue){
minValue = inputArray[i];
}
}
return minValue;
}
}