Created
April 24, 2023 11:50
-
-
Save SpotlightForBugs/174507ebac85230c676588092f06c110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
System.out.println(wasMacheIch(5, 5)); | |
} | |
/** | |
* Die Methode wasMacheIch berechnet das Produkt zweier Zahlen | |
* @param x die erste Zahl | |
* @param y die zweite Zahl | |
* @return das Produkt der beiden Zahlen | |
*/ | |
public static int wasMacheIch(int x, int y){ | |
if (y==1){ | |
return x; | |
} | |
else{ | |
return x + wasMacheIch(x, y-1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment