Hi, i have problem with this solution. Any ideas?
It calculate fine in other program.
package pl.codegym.task.task15.task1531;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
/*
Silnia
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int input = Integer.parseInt(reader.readLine());
reader.close();
System.out.println(factorial(input));
}
public static String factorial(int n) {
int t1 = 1;
int t2 = 1;
String total2;
if(n>0) {
for(int i = 0; i < n; i ++){
t1 = t1*t2;
t2++;
}
}
else {
t1 = 0;
}
//tutaj wpisz swój kod
return total2 = String.valueOf(t1);
}
}