How to Find Factorial Any Number in Java Programming Language
Hello Guys🤙
In Our Previous Block, We Have Seen the Basics of Java Programming and Some Simple Programs.
In today's Blog We will see How to make Factorial Number Program in Java Programming Language.
Program to Find Any Number Factorial in Java Programming Language.
Program - Find Factorial
import java. io.*;
import java.util.Scanner;
class Factorial
{
public static void main(String args[ ])
{
Scanner obj = new Scanner(System.in);
int no, i;
long factorial = 1;
System. out. println("Enter Any Number = ");
no = obj.nextInt();
for(i = 1; i<=no; i++)
{
factorial *= i;
System.out.println(factorial);
}
System.out.println("Factorial of "+no+" = "+ factorial);
}
}
Output - Run two Time -
Enter Any Number = 5
1
2
6
24
120
Factorial of 5 = 120
Enter Any Number = 8
1
2
6
24
120
720
5040
40320
Factorial of 8 = 40320
If You Want to Know more Java Programming Language - So
Click this Link 👇
If You Want to Know About CSS Language and It Web Design, then Click This Link 👇
Can You Want to See the Privacy Policy of this Page then Click on this Link 👇
Hope You Have Got Help in Learning Java Language and His Programs from this Blog. 🤙
Give Your Feedback on Comment Box 📦 👇
%20(1).jpeg)
.jpeg)
Nice
ReplyDeletePatidar 👍
ReplyDelete