package com;
public class Test2 {
public static void main(String[] args) {
int n = 10;
rec s = new rec();
System.out.println(n+"! = "+s.rec(n));
}
}
class rec
{
public long rec(int n)
{
long a= 0 ;
if(n ==1 )
{
a = 1;
}
else
{
a = n * rec(n-1);
}
return a;
}
} |
|