ora1 and ora2 half

This commit is contained in:
2025-09-16 08:26:44 +02:00
commit e0307d947c
24 changed files with 242 additions and 0 deletions

48
ora2/Main.java Normal file
View File

@@ -0,0 +1,48 @@
import java.util.Arrays;
import java.util.Scanner;
class Runner {
public static void main(String[] args) {
double[] arr = new double[5];
Scanner sc = new Scanner(System.in);
for (int i = 0; i < arr.length; i++) {
arr[i] = Double.parseDouble(sc.next());
}
sc.close();
System.out.println();
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
double sum = 0;
for (double d : arr) {
if (min > d) {
min = d;
}
if (max < d) {
max = d;
}
sum += d;
System.out.println(d);
}
System.out.println();
System.out.println("min: " + min);
System.out.println("max: " + max);
System.out.println("sum: " + sum);
System.out.println("avg: " + (sum / arr.length));
System.out.println(arr); // memoracim vagy object id
//
// sorting
System.out.println();
Arrays.sort(arr);
for (double d : arr) {
System.out.println(d);
}
}
}