ADDNATRL question issue

import java.util.*;

class remainder
{
public static void main (String[] args) {
try {
// Write your code here
Scanner in = new Scanner(System.in);
int t= in.nextInt();
int sum=0;
while(t > 0)
{
sum=sum+t;
t–;
}
System.out.println(sum);
}
catch(Exception e) {
}
}
}

This code is giving Right answer and when I submit the code it is showing wrong answer.