My issue
class Codechef
{
public static void main (String args) throws java.lang.Exception
{
// your code goes here
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t–>0){
int n=in.nextInt();
int x= in.nextInt();
int a=new int[n];
int count=0;
for(int j=0;j<n;j++){
a[n]=in.nextInt();
if(a[j]>=x){
count++;
}
}System.out.println(count);
}
}
}
please find the error and how to solve it
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t-->0){
int n=in.nextInt();
int x= in.nextInt();
int a[]=new int[n];
int count=0;
for(int j=0;j<n;j++){
a[n]=in.nextInt();
if(a[j]>=x){
count++;
}
}System.out.println(count);
}
}
}
Problem Link: ELECTN Problem - CodeChef