-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMaximum Values
More file actions
40 lines (31 loc) · 719 Bytes
/
Maximum Values
File metadata and controls
40 lines (31 loc) · 719 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
37
38
39
40
import java.util.Scanner;
class Maximum
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Size of array");
int size = sc.nextInt();
int[] a = new int[size];
System.out.println("Enter "+size+" Number");
System.out.println();
for(int i = 0; i<size; i++)
{
System.out.print("Enter Any Number::>");
a[i] = sc.nextInt();
}
int max = a[0];
for(int i = 0; i <a.length; i++)
{
if(a[i] > max)
max = a[i];
}
System.out.print(" Maximum Number Is "+max);
}
}
#python code
a_list = [5, 2, 7, 6, 3, 1, 9]
maximum = max(a_list)
print(maximum)
#python code for finding minimum
minimum = min(a_list)
print(minimum)