int kth_smallest_number(int A[], int n, int k){    /*kth smallest number is smaller than pr equal to n-k numbers in A*/    int smaller_than_count;    int i,j;    for(i=0; i<n; i++){        /*Check whether the number A[i] satisfies        the condition*/        smaller_than_count = 0;        for(j=0; j<n; j++){            if(A[i]<=A[j]){                smaller_than_count++;            }        }        if(smaller_than_count == n-k){            return A[i];        }    }}I just wanted to know if this solution is right, I am not worried about efficiency right now just correctness. 
A function that finds the kth smallest integer in array A (unsorted), of size n
c;algorithm