JAVA CODE
SABSE PEHLE TO EK COMPILER ADD KRIYE APNE PAGE PE
Question yaha padho uske baad dusre jagah jake code kro
_________________________________________________________________________
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int max = 0;
int min = 0;
int[] a = new int[n];
for(int i = 0; i < n;i++){
a[i] = sc.nextInt();
}
for(int i = 0 ; i max){
max = a[i];
}
}
System.out.println(max);
min = max;
for(int i = 0 ; i < n; i++){
if(a[i]<min){
min = a[i];
}
}
System.out.println(min);
}
def minmax(arr):
max=arr[0]
n=len(arr)
for i in range(1, n):
if arr[i] > max:
max = arr[i]
print(max)
arr=[12,45,78,95,653,233,451,101]
print(max(arr))
print(min(arr))
JAVA CODE
SABSE PEHLE TO EK COMPILER ADD KRIYE APNE PAGE PE
Question yaha padho uske baad dusre jagah jake code kro
_________________________________________________________________________
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int max = 0;
int min = 0;
int[] a = new int[n];
for(int i = 0; i < n;i++){
a[i] = sc.nextInt();
}
for(int i = 0 ; i max){
max = a[i];
}
}
System.out.println(max);
min = max;
for(int i = 0 ; i < n; i++){
if(a[i]<min){
min = a[i];
}
}
System.out.println(min);
}