You are not logged in. Please login at to post your questions!


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..

asked 28 Jun '13, 22:44

shivam217's gravatar image

accept rate: 20%

edited 28 Jun '13, 23:38

kunal361's gravatar image


can u pls provide the problem link!!!

(28 Jun '13, 23:40) kunal3614★
(28 Jun '13, 23:50) jaythegenius3★
(29 Jun '13, 00:32) shivam2174★

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

(29 Jun '13, 00:35) jaythegenius3★

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

(29 Jun '13, 00:41) shivam2174★

Yeah No problem!!

(29 Jun '13, 01:04) jaythegenius3★
showing 5 of 6 show all

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!!


answered 28 Jun '13, 23:50

jaythegenius's gravatar image

accept rate: 4%

edited 28 Jun '13, 23:52

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.


answered 29 Jun '13, 00:02

junior94's gravatar image

accept rate: 15%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 28 Jun '13, 22:44

question was seen: 1,706 times

last updated: 29 Jun '13, 01:04