• + 6 comments

    You can use this logic to reduce the code. {

    int count

    for(int i = 0 ; i <= n; i++){

        for(int j = 0; j < n; j++ ){
    
            if(i < j){
    
                if((a[i]+a[j])%k == 0){
                    count++; 
    
                }
            }
        }
    }
    

    }