Write a Java program to find factorial of given number
Answers
Answered by
7
// A program in Java to find factorial of a number without recursion
// Created by Mahnaz Hazra
class Factorial
{
/* the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. */
public static void main(String[] args)
{
int number = 14; // sample number
int factorial = number;
for (int i = (number - 1); i > 1; i--)
{
factorial = factorial * i;
}
System.out.print(number +"! = " + factorial);
}
}
Attachments:
Answered by
4
Answer:
this is the answer it is the Java program
Attachments:
Similar questions