2024-05-10 06:01:49 +00:00
|
|
|
package VL03.Aufgabe02;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Vorlesung 3 / Aufgabe 2
|
|
|
|
*
|
|
|
|
* @author Sebastian Brosch
|
|
|
|
*/
|
|
|
|
public class Aufgabe02 {
|
2023-12-05 14:38:37 +00:00
|
|
|
public static void main(String[] args) {
|
|
|
|
int a1 = 2;
|
|
|
|
int a2 = 4;
|
|
|
|
int a3 = 6;
|
|
|
|
|
2024-05-10 06:01:49 +00:00
|
|
|
System.out.printf("a1: %d, a2: %d, a3: %d\n\n", a1, a2, a3);
|
|
|
|
|
2023-12-05 14:38:37 +00:00
|
|
|
System.out.println("a.) Arithmetisches Mittel: " + ((a1 + a2 + a3) / 3));
|
|
|
|
System.out.println("b.) Ist " + a1 + " < " + a2 + " < " + a3 + "? " + (a1 < a2 && a2 < a3 ? "Ja" : "Nein"));
|
2024-05-10 06:01:49 +00:00
|
|
|
System.out.println("c.) Ist " + a1 + " ein Vielfaches von " + a2 + "? " + (a1 % a2 == 0 ? "Ja" : "Nein"));
|
2023-12-05 14:38:37 +00:00
|
|
|
System.out.println("d.) " + a3 + " invertiert: " + (~a3));
|
|
|
|
|
|
|
|
a3 = Integer.MAX_VALUE;
|
|
|
|
System.out.println("e.) Größter positiver Integer-Wert: " + (a3));
|
|
|
|
System.out.println("f.) Größter postiver Integer-Wert + 1: " + (a3 + 1));
|
2024-05-10 06:01:49 +00:00
|
|
|
|
|
|
|
a2 = 0xFFFFFFFF;
|
|
|
|
a2 = ~(a3 << a2);
|
|
|
|
System.out.println("g.) a2 (0xFFFFFFFF) nach a3 umwandeln: " + a2);
|
2023-12-05 14:38:37 +00:00
|
|
|
}
|
|
|
|
}
|