Mahmoud_Hawara

PA07-4

Dec 30th, 2025
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.23 KB | None | 0 0
  1. public class Main {
  2.    
  3.     public static int multiplyRec(int x, int y) {
  4.         if (y == 0) return 0;
  5.         return x + multiplyRec(x, y - 1);
  6.     }
  7.    
  8.     public static void main(String[] args) {
  9.         System.out.println(multiplyRec(5, 3));
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment