Hi,
I am trying to solve the following problem.
But I keep getting NZEC error. Could anyone please point out the cause of the error…
I’ve tried everything…
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str[] = br.readLine().split("-");
int start = Integer.parseInt(str[0]), stop = Integer.parseInt(str[1]), count=0;
ArrayList a = new ArrayList();
for(int i=start;i<=stop;i++) {
if(Integer.toString(i).contains(Integer.toString(13))) {
count++;
a.add(i);
}
}
System.out.println("No. of occurrence of 13 is "+count);
for(int j=0;j<count;j++)
System.out.println(a.get(j));
return;
}
}