Skip to content

Instantly share code, notes, and snippets.

@SpotlightForBugs
Created April 24, 2023 11:50
Show Gist options
  • Save SpotlightForBugs/174507ebac85230c676588092f06c110 to your computer and use it in GitHub Desktop.
Save SpotlightForBugs/174507ebac85230c676588092f06c110 to your computer and use it in GitHub Desktop.
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