What We Are Learn On This Post
Factorial Number Java Program
Write a Program to Find out Factorial Number In Java Example Program?
package com.java.Softwaretestingblog; import java.util.Scanner; public class Factorial { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in=new Scanner(System.in); System.out.println("Enter the number:-"); int n,fact=1; n=in.nextInt(); for(int i=1;i<=n;i++) { fact=fact*i; } System.out.println("Factorial Of"+ " n " + " Is :-" +fact); } }
Execution:
Java Program: Word Count Using Java
If the above image is not visible clearly then you can use this link
Output:
Enter the number:- 5 Factorial OfnIs :-120
Leave a Reply