Why do I get an NZEC?

Why m i getting NZEC (Non Zero Exit Code) for my program?

2 Likes

NZEC stands for Non Zero Exit Code. For C users, this will be generated if your main method does not have a return 0; statement. Other languages like Java/C++ could generate this error if they throw an exception.

9 Likes

Why am i getting this error in python???

14 Likes

how to resolve this If I am using Python??

4 Likes

Try using raw_input() to take input instead of input() because sometimes it happens that a space is left at the end of input which results in RunTimeerror.

1 Like

I tried using raw_input() but still
alt text

I’m new to these coding contests, bear me.

1 Like

getting NZEC for my java code, anyone any suggestions on how to make it work ?

If you are using raw_input().split(’ ') it may cause nzec because in test cases, there are usually extra spaces at the end. try raw_input().split() and nzec will not come.

t=float(raw_input())

s=float(raw_input())

if(t%5!=0 or t>s-0.5):
print s
else:
print s-t-0.5

why am i getting one in this??

@code_aholic seems code is for problem ATM…

One thing to note:

Input:
30 120.00

Output:
89.50

In input two values are on same line and the way your code receives input is wrong, it will work only for newline input.

So if you want to take multiple input from single line use map().

Here is an example:

Replace these two lines

t=float(raw_input())
s=float(raw_input())

with

t,s=map(float, raw_input().split())

And your code will be able to receive multiple input from single line…!!

:slight_smile:

4 Likes

Can Any one tell me why i am always getting NZEC for my java code ?? CodeChef: Practical coding for everyone

Thanks in advance

@the_darklord

I am not familiar with JAVA but when i run your code on ideone on giving test cases, your code returns stderr

Exception in thread "main" java.lang.NumberFormatException: For input string: "3 6"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:492)
	at java.lang.Short.parseShort(Short.java:117)
	at java.lang.Short.parseShort(Short.java:143)
	at ClosingTweet.main(Main.java:14)

Link : http://ideone.com/g1HO2W

1 Like

i have used raw_input().split() method but still getting a nzec.why??
can anyone help me

1 Like

Why I am getting NZEC error while using BufferedReader Input in JAVA for my solution??(while scanner type input is accepted)

1 Like

hi,

i keep getting NZEC and would like to know if there is a way i can get the inputs used for testing my code.
this is my code http://www.codechef.com/viewsolution/5778355

thanks
Sivan

I’ve searched through forums and similar code but I’m still getting NZEC. I suspect it could be something with input/output or an index going out of bounds on an array. Any suggestions? CodeChef: Practical coding for everyone

http://www.codechef.com/viewsolution/6345015
why NZEC in java code ??? any help please

My python code is encountering the NZEC error.

How will my code be able to receive multiple input from single line, if those inputs are in the form of an array.

Please tell me what to change in this piece of code, to be able to accept an array of inputs from the user.

pies=[]

for j in range(0,np):

pies.append(int(raw_input()))

This is the code to receive input if they are printed on consecutive lines.
The problem is that all the inputs are being entered on the same line, but how do i receive the array of inputs from the same line?

why i m getting NZEC in C code i have written the statement return 0;

My all programs give NZEC error when submitting when using C#.
All the programs work perfectly with IDE. Any help ?
It’s a shame there’s no support for this problem.

3 Likes