Monday 7 December 2020

Factorial of Number without User Interaction

public class FactorialWithoutUserInteraction 
{
	public static void main(String[] args) 
	{
		int fact=1;
			for(int i=1;i<=8;i++)
			{
				fact=fact*i;
			}
	System.out.println("\n Factorial of 8 is = "+fact);
	}
}

Output:

Factorial of 8 is = 40320

No comments:

Post a Comment

If you have any doubts, please let me know

Pattern 31 & 32