My issue
why it not accepting the correct code
My code
// We have populated the solutions for the 10 easiest problems for your support.
// Click on the SUBMIT button to make a submission to this problem.
/**import java.util.*;
import java.lang.*;
import java.math.*;
// Name of the class has to be "Main" only if the class is public.
class Codechef
{
public static long factorial(long n){
if(n==0){
return 1;
}
return n*factorial(n-1);
}
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
long n,f,t;
t=sc.nextInt();
while(t-->0){
n=sc.nextInt();
f=factorial(n);
System.out.println(f);
}
}
}*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
class Codechef {
public static long factorial(long n) {
if (n == 0) {
return 1;
}
return n * factorial(n - 1);
}
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
while (t-- > 0) {
long n = Long.parseLong(br.readLine());
long f = factorial(n);
System.out.println(f);
}
}
}
Problem Link: FCTRL2 Problem - CodeChef