Java unsolving question
import java.util.Scanner; import java.util.*; import java.util.ArrayList; import java.util.Collections; public class Program { public static void main(String[] args) { Scanner s = new Scanner(System.in); ArrayList<Integer>list= new ArrayList<>(); ArrayList<Integer>list2= new ArrayList<>(); int num1= s.nextInt(); int num2= s.nextInt(); for(int n= num1; n<=num2;n++) { int count=0; for(int i=1;i<=n;i++) { if(n%i==0) { count++; } } if (count==2) { list.add(n); } } System.out.println("prime numbrs of list1"+":"+list); for(int i=0;i<=list.size()-1;i++) { for(int k=0;k<=list.size()-1;k++) { int a=list.get(i); int b=list.get(k); String t=Integer.toString(a); String s1=Integer.toString(b); String res=t+s1; int result=Integer.parseInt(res); int count2=0; for(int j=1;j<=result;j++) { if (result%j==0) { count2++; } if(count2==2) { list2.add(result); } } } System.out.println("prime numbers of list2"+":"+list2); int one=Collections.min(list2); int two=Collections.max(list2); System.out.println("small no. :"+ one); System.out.println("small no. :"+ two); for(int i=1; i<=list2.size()-2;i++) { int c= one+two; one=two; two=c; if(i==list2.size()-2) { System.out.println(c); } } }} Iam getting error in it. Could u help me If input: 30 70 Output should be : 2027041