|
| Factorial Number by sankarguru T | Class Factorial(){
public static void main(String args[]){
//calculate 2 factorial
int a=2;
int factValue=fact(2);
System.out.println("fact value======="+factValue);
}
public static int fact(int n){
if(n<=0){
return 1;
}
else{
return (n*fact(n-1));
}
}
Ans: 2 | Views 15
Rating 0
Language Java
Category Basics
Compiler Eclipse
OS Windows
Last Modified 18th Nov 09 08:53:23 AM
|
|
|
|
|
|