|
@ -3,6 +3,34 @@ package LernProgramm; |
|
|
import java.util.Scanner; |
|
|
import java.util.Scanner; |
|
|
|
|
|
|
|
|
public class FunktionenAusgelagert { |
|
|
public class FunktionenAusgelagert { |
|
|
|
|
|
|
|
|
|
|
|
public static void Fakultaet() { |
|
|
|
|
|
|
|
|
|
|
|
try (Scanner scanner3 = new Scanner(System.in)) { |
|
|
|
|
|
String numbera = scanner3.nextLine(); |
|
|
|
|
|
int number = Integer.parseInt(numbera); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (number <= 0) { |
|
|
|
|
|
System.out.println("1"); |
|
|
|
|
|
} |
|
|
|
|
|
int result = 1; |
|
|
|
|
|
for (int i = 1; i <= number; i++) { |
|
|
|
|
|
result *= i; |
|
|
|
|
|
} |
|
|
|
|
|
System.out.println(result); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
// TODO Auto-generated catch block |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void schaltjahr() { |
|
|
public static void schaltjahr() { |
|
|
|
|
|
|
|
|
System.out.println("Welches Jahr möchtest du untersuchen?"); |
|
|
System.out.println("Welches Jahr möchtest du untersuchen?"); |
|
|