Java program to Find Factorial of Given no.

1
2
3
4
5
6
7
8
9
10
11
class Factorial{
	public static void main(String args[]){
		int num = Integer.parseInt(args[0]); //take argument as command line
		int result = 1;
		while(num>0){
			result = result * num;
			num--;
		}
		System.out.println("Factorial of Given no. is : "+result);
	}
}
surajk

One thought on “Java program to Find Factorial of Given no.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in