please help me with my codes, it doesnt work somehow

```
import java.util.Scanner;
public class calculateE
{
public static long factorial( int n )
{
if( n <= 1 ) // base case
return 1;
else
return n * factorial( n - 1 );
}
public static void main( String [ ] args )
{
Scanner input = new Scanner( System.in );
System.out.print( "Enter the terms to calculate: " ); // prompt
int n = input.nextInt(); // input
double e = 1;
//int t = 10;
//int x = 7;
for (int i = 1; i < n; i++) {
e = ( e + (1/(factorial( n + 1 ))) );
}
if ( n < 0 )
System.out.print("Invalid input");
else
System.out.println( factorial( n ) );
}
}
```