You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class main {
public static void main(String[] args) {
int[] arr = {10, 5, 20, 8, 15};
int max = arr[0];
for (int i = 1; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}
}
System.out.println("The largest element in the array is: " + max);
}
public class largestelement{
public static void main(String[] args){
int[] array ={15,89,8,26,33};
int max= array[0];
for(int i=1;i<array.length;i++){
if(array[i]>max){
max=array[i];
}
}
System.out.println("The largest element in the array is: "+max);
}
}
public class Main {
public static void main(String[] args) {
int[] numbers = {10, 25, 50, 5, 35, 75};
int max = numbers[0];
for (int i = 1; i < numbers.length; i++) {
if (numbers[i] > max) {
max = numbers[i];
}
}
System.out.println("The largest element in the array is: " + max);
}
Activity
ghost commentedon Oct 6, 2023
public class main {
public static void main(String[] args) {
int[] arr = {10, 5, 20, 8, 15};
}
Riddhi-Codes7 commentedon Jul 19, 2024
public class LargestElement{
public static void main(String[] args)
{
double[] arrays = {45.8, 1000.0, -90.3, -1000.0, 200.9};
double largest = arrays[0];
}
System.out.println("Largest number in the Array is: " +largest);
}
}
shreyasssdats commentedon Jul 24, 2024
krishna-1284 commentedon Aug 9, 2024
public class Main {
public static void main(String[] args) {
}