Computer Science, asked by tan20, 1 year ago

multifactorial programme through java

Answers

Answered by Rajdeep11111
1
HEY FRIEND!

If your question is to find the factorial of a number, here's your answer:

I am using Scanner class.

import java.util.*;
class Factorial
{
public static void main (String args[])
{
Scanner sc = new Scanner (System.in);
int fn = 1, i, num;
System.out.print("Enter the number: ");
num = sc.nextInt();
for (i = 1; i <= num; i++)
{
fn = fn * i;
}
System.out.println("The factorial of " + num + " is " + fn);
}
}


THANKS!
Similar questions