Answers for "Write a program to find factorial of a number using for loop in java"

1

Write a program to find factorial of a number using for loop in java

public class Main
{
public static void main(String[] args)
{
int num = 15;
long factorial = 1;
for(int i = 1; i <= num; ++i)
{
factorial = factorial * i;
}
System.out.printf("Factorial of %d is", factorial);
}
}
Posted by: Guest on June-12-2021

Code answers related to "Write a program to find factorial of a number using for loop in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language