Run time error in code

Please resolve the error

@tushaartiwari1997,
You can only do this int *y = new int[n]; after you have input n, because else you would have a garbage value stored at &n which could be large maybe 1e9, which gives runtime, because you can’t allocate that large array.