this is my code
Just change line no 8 of your code as, int a[m][n];, and then try to submit the code…