Mahmoud_Hawara

PA07-3

Dec 30th, 2025
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. public class Main {
  2.    
  3.     public static int fact(int n) {
  4.         if (n == 0) return 1;
  5.         return n * fact(n - 1);
  6.     }
  7.    
  8.     public static double euler(int n) {
  9.         if (n == 0) return 1;
  10.         return 1.0 / fact(n) + euler(n - 1);
  11.     }
  12.    
  13.     public static void main(String[] args) {
  14.         System.out.println(euler(5));
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment