Computer Science, asked by ankitmaiti11, 14 hours ago

Write a program in Java to enter a numbers as argument. Find and print the factorial of it.
[Factorial of a number is the product of natural numbers up to this number.]​

Answers

Answered by astread7d5
1

Answer:

Factorial Program using loop in java

class FactorialExample{

public static void main(String args[]){

int i,fact=1;

int number=5;//It is the number to calculate factorial.

for(i=1;i<=number;i++){

fact=fact*i;

}

System.out.println("Factorial of "+number+" is: "+fact)

Similar questions