getting an NZEC error

can u please tell me whats wrong in this program???
import java.io.*;
class orange
{
public static void main(String args []) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int cash=100; // total cash be rs 100
int n=10 ; // number of oranges be 10
int cost[]=new int[10];
int weight[]=new int[10];

       for(int j=0;j<n;j++)
    {
        System.out.println("enter cost and weight"); // intialisng one by one
        cost[j]=Integer.parseInt(br.readLine());
        weight[j]=Integer.parseInt(br.readLine());
    }
    // forming the set
   int sum=0;
   int weight1=0;
  // finding the maximum weight
  int max=0;
  for(int k=0;k<n;k++)
  {
      if(max<weight[k])
      max=weight[k];
    }
    // finding the minimum weight
    int min=weight[0];
    for(int l=0;l<n;l++)
    {
        if(min>weight[l])
         min=weight[l];
        }
   for(int m=0;m<n;m++)
    {
        if(sum<=cash)
        {
            if(weight[m]==max)
            {
                sum=sum+cost[m];
               weight1=weight1+max;
            }
             
            
        }
    }
   // if sum of money is not equal  to total cash
   if(sum<cash)
   {
       for(int p=0;p<n;p++)
   {
        if(sum<=cash)
        {
            if(weight[p]>min&&weight[p]<max)
            {
                sum=sum+cost[p];
                weight1=weight1+weight[p];
            }
        }
    }
}
// if sum still not  equal to cash
   if (sum<cash)
   {
       for(int o=0;o<n;n++)
       {
           if(sum<=cash)
           {
               if(weight[o]==min)
               {
                   sum=sum+cost[o];
                   weight1=weight1+min;
                }
            }
        }
    }
    System.out.println(weight1);
}

}