Below is my code to convert the binary to decimal but my doubt is that when I enter my data as 100000 it's giving exact answer. How is it giving the correct answer even the range of integer is exceeded?
int main()
{int rem,deci=0,a=1,b;
int bin;
printf("size of int :- %d",sizeof(int));
printf("enter the binary value");
scanf("%d",&bin);
while(bin!=0)
{
rem=bin%10;
deci=deci+rem*a;
a=a*2;
bin=bin/10;
}
printf("%d \n",deci);
}