Run Time Error(NZEC) in java..plz help


public class SumInTriangle {
	public static void main(String args[]) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(;
	int[][] arr=new int[100][100];
	int testcases =Integer.parseInt(br.readLine());
	int n = Integer.parseInt(br.readLine());
	for(int i=0;i<n;i++)
	for(int j=0;j<=i;j++)
	arr[i][j]= Integer.parseInt(br.readLine());
	for(int i=n-2;i>=0;i--)
	for(int j=0;j<=i;j++)



I am getting a Run Time Error(NZEC) in this program…although it is working in my eclipse and giving correct output…plz help…
If any extra code line is needed or any new concept…plz explain it…because I am new to java and learning it…plz help…

can u pls provide the problem link!!!

Take this as a hint…
The problem you are getting is while taking input!!While running on ideone,it gives number format exception!!
Here is a link link text
Number format exception occurs when u try to convert a string into Number and when string is not appropriate.
The string should not contain any blank spaces…Hope this helps…
Try some other method as an input!!


here is problem link:

I think @shivam217 is trying to solve SUMTRIAN.

@shivam217 It’s giving NZEC error because of this line: arr[i][j]= Integer.parseInt(br.readLine());
In the input you’ll have to read multiple numbers in a single line. That code only works when the line you’re currently reading only has one number and nothing else.

1 Like

@kunal361 link of my solution is

I havent checked your logic!!..Here is ur same code with different input technique!!

@jaythegenius thanks for the link…It really helped me…thank u very much…

Yeah No problem!!