+ 1
Find the largest number
1,5,10
2 Antworten
+ 8
10,
in java :
int a=0;
int[] largest={1,5,10};
for(int x:largest){
if(x>a)
a=x;
}
System.out.println(a);
if you are using c++ you only change array declaration and for loop.:/
https://code.sololearn.com/cXjCK4ZOwBG1/?ref=app
this is c++ code
https://code.sololearn.com/cC285GI41ega/?ref=app
+ 3
Java:
System.out.print(Arrays.stream(new int[]{1, 5, 10}).max().getAsInt());
Output -> 10