I am getting NZEC error every time I try to submit code in java.
can someone help me out with this?
This is the solution to PROBLEM: FLOW007
/* package codechef; // don’t place package name! */
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. /
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
int lastDigit =0;
while(t–){
int n = scn.nextInt();
int ans =0;
while(n>0){
lastDigit = n%10;
n = n/10;
ans = ans10 + lastDigit;
}
System.out.println( ans);
}
}
}