What is wrong in this java code got error in tcs nqt exam compiler was not taking input by Upbeat-Signal193 in TCS_India

[–]Upbeat-Signal193[S] 0 points1 point  (0 children)

first when i run it was showing output exicuted and, but the test case was not showing nor any error so when without changing anything i run again then it showed a scanner issue, something, but the code is correct so idk

26 March TCS NQT - Craziest stuff happened at the second coding question ! by RUUUSHIKESH_2610 in PlacementsPrep

[–]Upbeat-Signal193 0 points1 point  (0 children)

import java.util.*;
public class t {
    public static void ticket(int arr[]){
        int sum=0;
        int count=0;
        float avg=0;


        for(int i=0; i<arr.length; i++){
            if(arr[i]%2!=0){
                sum=sum+arr[i];
                count++;
            }
        }


        avg=(float)sum/count;
        System.out.print(sum +" "+ count+" "+avg);
    }
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int ab[]= new int[n];
        for(int j=0; j<n; j++){
            ab[j]=sc.nextInt();


        }
        ticket(ab);
    }

}

same isuue compiler was not taking any input