import java.util.;
import java.lang.;
import java.io.*;
class TWONMS{
public static void main(String ergs[]) throws java.lang.Exception{
Scanner scannerT=new Scanner(System.in);
System.out.println(" ");
int T=scannerT.nextInt();
while(T-->0){
int i;
for(i=1;i<=T;i++){
int A=0;
int B=0;
int N=0;
Scanner scannerA=new Scanner(System.in);
System.out.println(" ");
A=scannerA.nextInt();
Scanner scannerB=new Scanner(System.in);
System.out.println(" ");
B=scannerB.nextInt();
Scanner scannerN=new Scanner(System.in);
System.out.println(" ");
N=scannerN.nextInt();
int max=0,min=0;
int j;
for(j=1;j<=N;j++){
if((j%2)==1)
A*=2;
else
B*=2;
}
if(A>B){
System.out.println((double)A/B);
}
else{
System.out.println((double)B/A);
}
}
}
}
}
Can you please tell me how to get rid of the error…
NZEC means “Non zero exit code”. Its essentially saying that your program ran into some error during execution**
https://www.quora.com/CodeChef-runtime-error-NZEC-Can-anyone-help
https://www.codechef.com/wiki/faq#Why_do_I_get_an_NZEC
i comented lines which were causing runtime error–
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package debugothercode;
/**
*
* @author Hemant Dhanuka
*/
import java.util.*;
import java.lang.*;
class TWONMS {
public static void main(String ergs[]) throws java.lang.Exception {
Scanner scannerT = new Scanner(System.in);
System.out.println(" ");
int T = scannerT.nextInt();
while (T-- > 0) {
int i;
for (i = 1; i <= T; i++) {
int A = 0;
int B = 0;
int N = 0;
//Scanner scannerA=new Scanner(System.in);
//System.out.println(" ");
A = scannerT.nextInt();
//Scanner scannerB=new Scanner(System.in);
//System.out.println(" ");
B = scannerT.nextInt();
// Scanner scannerN=new Scanner(System.in);
// System.out.println(" ");
N = scannerT.nextInt();
int max = 0, min = 0;
int j;
for (j = 1; j <= N; j++) {
if ((j % 2) == 1) {
A *= 2;
} else {
B *= 2;
}
}
if (A > B) {
System.out.println((double) A / B);
} else {
System.out.println((double) B / A);
}
}
}
}
}
Now no NZEC error but Giving wrong answer… so try to correct ur logic and submit it