Aufgabe 1-3

This commit is contained in:
Matti 2024-04-10 12:16:25 +02:00
parent cd47a7081c
commit ad40aef245
4 changed files with 44 additions and 1 deletions

View File

@ -4,7 +4,7 @@ public class Main {
public static void main(String[] args) {
// Press Alt+Eingabe with your caret at the highlighted text to see how
// IntelliJ IDEA suggests fixing it.
System.out.printf("Hello and welcome!");
System.out.println("Hello and welcome!");
// Press Umschalt+F10 or click the green arrow button in the gutter to run the code.
for (int i = 1; i <= 5; i++) {

7
src/part3/aufg1.java Normal file
View File

@ -0,0 +1,7 @@
package part3;
public class aufg1 {
public static void main(String[] args){
System.out.println("Hello World!");
}
}

23
src/part3/aufg2.java Normal file
View File

@ -0,0 +1,23 @@
package part3;
public class aufg2 {
public static void main(String[] args){
int a = 4;
int b = 2;
int c = 10;
System.out.println("Mittelwert aus a,b,c: " + (a+b+c)/3);
System.out.println("a < b < c: " + ((a < b) && (b < c)));
System.out.println("a = n * b: " + ((a % b) == 0));
System.out.println("2 Komplement c :" + ((~c) + 1));
c = Integer.MAX_VALUE;
System.out.println("Maximaler Int Wert: " + c);
System.out.println("Int.MAX + 1: " + (c + 1));
b = 0xFFFFFFFF;
System.out.println(b >>> 1);
}
}

13
src/part3/aufg3.java Normal file
View File

@ -0,0 +1,13 @@
package part3;
public class aufg3 {
public static void main(String[] args){
int a = 3;
int b = 4;
int c = 5;
boolean pythagoras_happy = (a*a +b*b == c*c);
System.out.println(pythagoras_happy);
}
}