# Field Manual for Hackers

## java - Write a program to sum the series 1!+2!+3!+---------+N!.

1. import java.util.Scanner;

class Test{

public static void main(String ar[])
{

Scanner sc=new Scanner(System.in);
long num,loop,factorial,nloop=1,input,sum=0;

System.out.println("Enter Number to find Factorial");
input=sc.nextLong();

while(nloop<=input)
{
loop=1;
factorial=1;
num=nloop;
while (loop <= num)
{
factorial=factorial*loop;
loop++;
}
sum+=factorial;
System.out.println("Factorial of "+num+" = "+factorial);
nloop++;
}

System.out.println("Sum of Factorial's = "+sum);

}
}

2. This comment has been removed by the author.

3. import java.util.Scanner;

class Test
{

public static void main(String ar[])
{
int num=100,sum=0,fac=1,i=1,j;
System.out.print("Enter the number of terms: ");
Scanner o= new Scanner(System.in);
num=o.nextInt();

while(i<=num)
{
j=i;
fac=1;
while(j>=1)
{
fac*=j;
j--;
}
sum+=fac;
i++;
}

System.out.println("The sum is: "+sum);

}
}

4. import java.util.Scanner;
class Series
{
public static void main(String ar[])
{
int N,Number,Total=0,Fact,Number1=1;
Scanner scan=new Scanner(System.in);
System.out.println("Enter the Number you want to calculate its Factorial");
N=scan.nextInt();
while(Number1<=N)
{
Number=Number1;
Fact=1;
while(Number>1)
{

Fact=Fact*(Number*(Number-1));
Number=Number-2;
}
System.out.print(Fact);
System.out.print(" ");
Number1++;
Total=Total+Fact;
}
System.out.println(" ");
System.out.println("Sum of N factorials="+Total);
}
}

5. import java.util.Scanner;
class Fact
{
public static void main(String Args[])
{
System.out.println(" enter the number\n");
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int sum=0;
for(int i=1;i<=n;i++)
{int j=i;
int num=1;
while(j>=1)
{
num*=j;
j--;
}sum=sum+num;

}System.out.println("the sum of factorial series is "+sum);
}}

6. import java.util.Scanner;
class Sumfact{
public static void main(String ar[]){
Scanner obj=new Scanner(System.in);
int sum=0,i=1,num,fact=1;
System.out.println("enter the number ");
num=obj.nextInt();
while(i!=num+1){
fact=fact*i;
sum=sum+fact;
i++;
}
System.out.println("the sum is"+sum);
}
}

7. import java.util.Scanner;
class SumFact{
public static void main(String ar[]){
Scanner scan=new Scanner(System.in);
System.out.println("Enter the number");
number=scan.nextInt();
while(number>1){
number--;
}
System.out.println("factorial of number is = "+answer);

System.out.println("Sum of factorial is= "+sum);
}
}

8. import java.util.Scanner;

class SumOfFactorial{

public static void main(String ar[]){

Scanner scan=new Scanner(System.in);
int num,fact=1,sum=0;
System.out.println("Enter number");
num=scan.nextInt();

for(int i=1;i<=num;i++){
//j=i;
for(int j=i;j<=i;j++){
fact=fact*j;
sum=sum+fact;

}

}
System.out.println("Result="+sum);

}

}