I am getting core dumped error while comp. code in coding block ide but program doesnot trough any error in other compiler please take a look

Check now , it was cause of logical error. Take char input as value of n is not given in question. So you can’t use it.

sir can you tell me why you write digit=arr[i]-β€˜0’ and if i remove β€˜0’ from then it goes some random output

Since arr is a char input right? It will be like β€˜2’, β€˜3’, or some other digit but in form of char. By doing, arr[i]-β€˜0’ what we are doing is converting that char form of arr[i] into int. For eg arr[i] = β€˜2’ so arr[i]-β€˜0’, will be β€˜2’ - β€˜0’ = 2 . This is known as typecasting. You can read about it through google. Hope now you would understand

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.