i have sorting program, it works well when coded in simple way but when used recursion it give the floating exception (core dumped), it have tries to debug and it show error in the division stage, it tires to do typecasting also, but does not work out for recursion
cin >>n;
cout <<"enter the number of elements:"<<endl;
for(i=0;i<n;i++)
cin >>a[i];
i=0;lrg=a[i];
while(i<n)
{
if(a[i]>lrg)
lrg=a[i];
i++;
}
digcnt=0;
while(lrg>0)
{
digcnt=digcnt+1;
lrg=(int)lrg/10; //probably error is here,
}
i=1;
divsr=1;
rad(divsr,digcnt,n,a);
my program takes input , when input is complete it gives floating exception (core dumped) error and program terminates, what is the error