Computer Science, asked by KevinbennyKEVIN8694, 11 months ago

Write a program to find the factorial of a number

Answers

Answered by Anonymous
2

I can do C++ , C or Javascript but I am doing in JAVA .

import java.util.*;

class factorial_print

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter the number");

int n=sc.nextInt();

for(int i=1;i<=n;i++)

{

for(int j=1;j<=i;j++)

f=f*j;

s=s+f;

}

System.out.println("Factorial is "+s);

}

}

Similar questions