Please tell me why i am getting runtime error,i cannot id my mistake

The logic you have applied to set the value of “range” variable is causing this error.

It is failing for many cases:
Example:
5
1 1 1 1 1
In this case, the value of max and min is same i.e. 1
Thus, range = max-min =0

Now, if you’ll define the array A[range] of length range. It will create an array of 0 length.

Later, you are accessing the index that does not exist in the statement inside the loop:
A[arr[i-1]-1];

Solution:
int range=max;

As you have to declare an array of size equal to the maximum number in the input array arr[].
Hence, you would be able to store counts of each number.

Also, there is no need of copying the value of Arr[] to arr[]
Just, directly print the Arr[].

Hope, this would help.
If you still have doubts, feel free to ask.