What is wron with this code?

public class Chekk {
static int ans(int n)
{
if(n==0)
return 1;
if(n==1)
return 2;
if(n<0)
return 0;
return ans(n-1)+(n-1);
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while (t>0)
{
int n=sc.nextInt();
System.out.println(ans(n));
t–;

        }
}

}

it should be ans(n-1)+ans(n-2)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.