#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define NUM 100

int main(void)
{
    int i, random_integer, position;
    int result[NUM] = {0};

    for (i=0; i<1000000; i++)
    {
        /* rand() mod NUM^2 */
        random_integer = rand() % (NUM * NUM);

        /* square root */
        position = sqrt(random_integer);

        result[position]++;
    }

    for (i=0; i<NUM; i++)
    {
        printf("arr[%d] = %d\n", i, result[i]);
    }
    return 0;
}