The code seems to work fine for computing PI using Hit & Miss Monte Carlo algorithm. In this code the variable 'c' is the number of hits and the variable 's' is the total number of samples i.e. hits + misses.
This code can be optimized further in terms of performance in MATLAB using vectorization. This link mentions how this can be done. However for illustration purpose I have taken the liberty to modify the code as below to show how to compute hits and misses using both vectorization and looping techniques. If this is not what you were looking for then kindly elaborate on the query.
y=rand ([1 n]);
radii = sqrt(x.^2+y.^2);
hits = sum(radii<=1);
misses = n-hits;
pi_mc = 4*(hits/n);
fprintf('\nUsing Vectorization:: HITS = %d, MISSES = %d, PI = %f\n',hits,misses,pi_mc);
if x(i)^2 +y(i)^2 <=1
fprintf('\nUsing Loop:: HITS = %d, MISSES = %d, PI = %f\n',c,s-c,pi_);